87,903
社区成员
发帖
与我相关
我的任务
分享
<div id="div1" style="background-color:blue;width:130px;" onmouseover="show();" onmouseout="hidden();">把鼠标移上来看看</div>
<div id="div2" style="position:absolute;z-index:10;background-color:red;width:200px;height:100;display:none;">DIV2</div>
<script>
function show(){
var event=event||window.event;
document.getElementById("div2").style.display="";
document.getElementById("div2").style.left=event.clientX+"px";
document.getElementById("div2").style.top=event.clientY+"px";
}
function hidden(){
document.getElementById("div2").style.display="none";
}
</script>