您的位置:首页 > Web前端 > JavaScript

js实现div跟谁鼠标悬浮移动显示

2011-11-07 16:56 330 查看
js实现div跟谁鼠标悬浮移动显示 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

2 <HTML>
3 <style>
4 #hint{
5 width:198px;
6 border:1px solid #000000;
7 background:#99ff33;
8 position:absolute;
9 z-index:9;
padding:6px;
line-height:17px;
text-align:left;
top:1520px;
}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
function showme(){
var oSon = window.document.getElementById("hint");
if (oSon == null) return;
with (oSon){
innerText = guoguo.value;
style.display = "block";
style.pixelLeft = window.event.clientX + window.document.body.scrollLeft + 6;

style.pixelTop = window.event.clientY + window.document.body.scrollTop + 9;

}
}
function hidme(){
var oSon = window.document.getElementById("hint");
if(oSon == null) return;
oSon.style.display="none";
}
//-->
</SCRIPT>
<BODY>
<text id="guoguo" value="ga">
                 <a href="#" onmouseover="showme()" onmouseout="hidme()" onmousemove="showme()">dfdfd</a><br><br><br><br><br>               <a href="#" onmouseover="showme()" onmouseout="hidme()" onmousemove="showme()">dfdfd</a><br><br><br><br>             <a href="#" onmouseover="showme()" onmouseout="hidme()" onmousemove="showme()">dfdfd</a><br><br><br>           <a href="#" onmouseover="showme()" onmouseout="hidme()" onmousemove="showme()">dfdfd</a><br><br>         <a href="#" onmouseover="showme()" onmouseout="hidme()" onmousemove="showme()">dfdfd</a><br>                                                                    <a href="#" onmouseover="showme()" onmouseout="hidme()" onmousemove="showme()">dfdfd</a><br>
<div id="hint" style="display:none"></div>
</BODY>
</HTML>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: