求助,关于event
当前鼠标坐标为:
X:<span id="mp_x"></span>
Y:<span id="mp_y"></span>
<div id="Container" onmouseover=DisplayMp(event) style="border:1px dashed #ff9900;height:200px;">
</div>
<script type="text/javascript">
window.onload = function(){
DisplayMp = function(event){
document.getElementById("mp_x").innerHTML = event.clientX + "px";
document.getElementById("mp_y").innerHTML = event.clientY + "px";
}
document.getElementById("Container").onmouseover = function(event){
document.getElementById("mp_x").innerHTML = event.clientX + "px";
document.getElementById("mp_y").innerHTML = event.clientY + "px";
}
}
</script>
//----------------------------------------------------------
上面两种写法 前面那种写法没问题
后面那种写法不能正常取到坐标,请问该怎么做?