<br> <br><title>test</title> <br><script language="javascript" type="text/javascript"> <BR>window.onload = function() <BR>{ <BR>var oImg = document.getElementById("myImg"); <BR>oImg.onclick = handle; <BR>oImg.onmouseover = handle; <BR>} <BR>function handle(oEvent) <BR>{ <BR>var oDiv = document.getElementById("display"); <br><br>//处理浏览器兼容性,获得事件对象 <BR>if(window.event) //判断是否为IE浏览器 <BR>{ <BR>oEvent = window.event; <BR>} <br><br>if(oEvent.type == "click") <BR>{ <BR>oDiv.innerHTML += "点击<br>"; <BR>} <BR>if(oEvent.type == "mouseover") <BR>{ <BR>oDiv.innerHTML += "移动<br>"; <BR>} <BR>} <BR></script> <br> <br> <br><img id="myImg" src="test.gif" alt="通用JS事件写法实现代码_表单特效" > <br><div id="display"></div> <br> <br>