- 3- 我呸 - 不守规矩的IE 4心眼儿的FF
<html>
<head>
<title> event test </title>
<script>
function broswerType(){
return "FF";
}
function whichOne(e){
var element;
var broswer = broswerType();
if("IE" == broswer){
element = window.event.srcElement;
}else if("FF" == broswer){
element = e.target;
}
}
function ready(){
document.getElementById("btn").onclick = whichOne;
}
</script>
</head>
<body οnlοad="ready()">
<input id="btn" name="hello" type="button" value="click" />
</body>
</html>
see below >>>
document.getElementById('x').οnclick= function(e ){...}
FF会填充这个e , ie不会
<html>
<body>
<input id="x" type="button" value="click it" />
<script>
document.getElementById('x').onclick = function(e){if(!e){e=window.event};alert(e.clientX+','+e.clientY)};
</script>
</body>
</html>