日期:2014-05-17  浏览次数:20620 次

document.onclick中event的问题
<html>
<head>
<title> click </title>
<script   language= "javascript ">
document.onClick   =   clickstat();


function   clickstat()  
{        
var   tempx,tempy;
tempx   =   event.clientX   +   document.body.scrollLeft;        
tempy   =   event.clientY   +   document.body.scrollTop;
alert( "ok ");
}
</script>
</head>
<body>

</body>
</html>
RT,无法获取event?请问大家是怎么回事...谢谢

------解决方案--------------------
<html>
<head>
<title> click </title>
<script language= "javascript ">

function clickstat()
{
var tempx,tempy;
tempx = event.clientX + document.body.scrollLeft;
tempy = event.clientY + document.body.scrollTop;
alert( "ok ");
}
document.attachEvent( "onclick ",clickstat);
</script>
</head>
<body>

</body>
</html>

---------------------------------------------或者---------------------------------
<html>
<head>
<title> click </title>
<script language= "javascript ">

document.onclick = function()
{
var tempx,tempy;
tempx = event.clientX + document.body.scrollLeft;
tempy = event.clientY + document.body.scrollTop;
alert( "ok ");
}

</script>
</head>
<body>

</body>
</html>
------解决方案--------------------
document.onclick = clickstat; 就可以了。