JavaScript中的event对象
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JS事件-event事件对象</title>
<script type="text/javascript">
window.onload=function()
{
document.onclick=function(ev){
//event对象:用来获取事件的详细信息:鼠标位置,键盘按键
//IE,Chrome兼容,FF不兼容:
//alert('横坐标:'+event.clientX+',纵坐标:'+event.clientY);
//FF:
//alert('横坐标:'+ev.clientX+',纵坐标:'+ev.clientY);
var oEvent=ev || event;//兼容写法
alert('横坐标:'+oEvent.clientX+',纵坐标:'+oEvent.clientY)
};
};
</script>
</head>
<body>
</body>
</html>