标签:
var button = document.getElementById("buttonId"); if(button.addEventListener){ button.addEventListener("click",eventFunction,false); }else if(button.attachEvent){ button.attachEvent("onclick",eventFunction); }
2、属性:
altKey, button, cancelBubble, clientX, clientY, ctrlKey, fromElement, keyCode, offsetX, offsetY, propertyName, returnValue, screenX, screenY, shiftKey, srcElement, srcFilter, toElement, type, x, y |
//IE:有window.event对象 //FF:没有window.event对象。可以通过给函数的参数传递event对象。如onmousemove=doMouseMove(event) <script> function test(event) { var event = event || window.event; //do Something } </script> <input type="button" value="click" onclick="test(event)"/>
标签:
原文地址:http://www.cnblogs.com/chenlogin/p/4776983.html