JS技巧:JS教程:鼠標(biāo)懸停文字上顯示圖片
當(dāng)前位置:點晴教程→知識管理交流
→『 技術(shù)文檔交流 』
效果如下所示: <html>
<head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>JS教程:鼠標(biāo)懸停文字上顯示圖片</title> <script language="javascript"> function showPic(sUrl){ var x,y; x = event.clientX; y = event.clientY; document.getElementById("Layer1").style.left = x; document.getElementById("Layer1").style.top = y; document.getElementById("Layer1").innerHTML = "<img src=\"" + sUrl + "\">"; document.getElementById("Layer1").style.display = "block"; } function hiddenPic(){ document.getElementById("Layer1").innerHTML = ""; document.getElementById("Layer1").style.display = "none"; } </script> </head> <body> <div id="Layer1" style="display:none;position:absolute;z-index:1;"></div> <img src="/images/logo.gif" onmouseout="hiddenPic();" onmousemove="showPic(this.src);" /> <p></p> </body> </html> 該文章在 2010/8/17 23:13:28 編輯過 |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |