<div class="codetitle"> <span><a style="CURSOR: pointer" data="14959" class="copybut" id="copybut14959" onclick="doCopy('code14959')"><u>复代码码</u></a></span> 代码如下:</div> <div class="codebody" id="code14959"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 전환//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3.org/1999/xhtml"> <br><머리> <br><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <br><title>无标题文档</title> <br><style type="text/css"> <br>#Adiv div {float:left; width:100px;border:1px solid #333;margin-top:100px;} <br>#SDiv {너비:135px;위치: 절대;} <br></style> <br><script type="text/javascript" src="js/jquery-1.7.2.js"></script> <br><script type="text/javascript"> <br>$(function(){ <br>var x = -90; <br>var y = -70; <br>$("#Adiv div").mouseenter(function(e){ <br>this .xx = ($(this).index() 1) * 100; <br>this.yy = $(this).offset().top <br>var login = $(this).attr("href) "); <br>if($("#SDiv")){$("#SDiv").remove();} <br>var div = "<div id='SDiv' style='border: 1px 솔리드 #333'><img src='images/login_box/box_onmouse.png' border='0' usemap='#Map' /><map name='Map' id='Map'> <area shape='direct' id='divLogin' coords='16,14,67,35' href=" 로그인 " /><area shape='direct' id='divRegister' coords='75, 15,127,37' href='http://www.baidu.com' /></map></div>"; <br>$("body").append(div); <br> $("#SDiv").css({ "top": (this.yy y) "px", "left": (this.xx x) "px" }) <br>}).mouseleave(함수 (e) { <br>var ex = e.pageX; <br>var ey = e.pageY; <br>var sx = $("#SDiv").offset().top <br>var sxx = $("#SDiv").offset().top 72; <br>var sy = $("#SDiv").offset().left <br>var syy = $("#SDiv").offset; ().left 135 <br>if(ey > sx && ey <= sxx && ex > sy && ex <= syy){ <br>$("#SDiv").mouseleave(function(){$("#SDiv").remove();}); <br>거짓을 반환합니다. <br>} <br>$("#SDiv").remove(); <br>}); <br>}) <br></script> <br></head> <br><br><br><본문> <br><!-- <BR><div class="box_onmouse"><img src="images/login_box/box_onmouse.png" border="0" usemap="#Map" /> <br><지도 이름="지도" id="지도"> <br><area shape="direct" id="divLogin" coords="16,14,67,35" href="#" /> <br><area shape="direct" id="divRegister" coords="75,15,127,37" href="#" /> <br></지도> <br></div> <br>--> <br><div id="Adiv"> <br><div href="11111">1111111</div> <br><div href="22222">2222222</div> <br><div href="33333">3333333</div> <br></div> <br><div>项目中有这样的需求:鼠标移动到某个div上面时动态创建一个层,这个层中有2个按钮图文(美工切换了),每个图 Pictures链接不同地址(链接地址모든 앞면 div提供),鼠标移除这个层则移除创建的div,如果鼠标移动到这个创建的div上面则不移除</div> <br></body> <br></html> <br> </div>