日期:2014-05-16 浏览次数:20376 次
<script>
function clickme(){
alert(event.clientX);
}
</script>
<div onclick="clickme(event)">Click Me!</div>
<div id="d1">Click Me!</div>
<script type="text/javascript">
function clickme(){
alert(event.clientX);
}
var oDiv = document.getElementById('d1');
//IE
if(oDiv.attachEvent){
oDiv.attachEvent("onclick",clickme);
} else if(oDiv.addEventListener){
//FireFox
oDiv.addEventListener("click",clickme,true);
}
</script>