以下为引用的内容: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>跟随鼠标的层 - 建站学院</title> <script type="text/javascript"> function show_mp() { var obj=document.getElementById(’mpDiv’); var L=T=0; var divWidth=220; var divHeight=70; var padding=15; var R= document.body.scrollLeft+document.body.clientWidth-divWidth; var B = document.body.scrollTop+document.body.clientHeight-divHeight; var x=document.body.scrollLeft+event.clientX; var y=document.body.scrollTop+event.clientY;
obj.style.display="none"; if (x < L) { x = x+divWidth;} if (x > R){ x = x-divWidth-padding*2;} if (y < T) { y = T+divHeigh; } if (y > B) { y = B-padding*2; } obj.style.left=x+padding; obj.style.top=y+padding; obj.style.display=""; } function hidden_mp() { var obj=document.getElementById(’mpDiv’); obj.style.display="none"; } </script> </head> <body> <a href="#" onMouseOver="show_mp()" onMouseOut="hidden_mp()">afasdfds</a> <div id="mpDiv" style='width: 220px; overflow: hidden; position:absolute; z-index:5; display:none;'> <table width="220" border="0" cellpadding="0" cellspacing="1" bgcolor="#fc9c0a"> <tr> <td height="70" valign="top" bgcolor="#ffffff" style='padding:5px;'></td> </tr> </table> </div> </body> </html>