1.HTML对象获取问题
FireFox:document.getElementById("idName");ie:document.idname或者document.getElementById("idName").解决办法:统一使用document.getElementById("idName");
2.const问题
说明:Firefox下,可以使用const关键字或var关键字来定义常量;IE下,只能使用var关键字来定义常量. 解决方法:统一使用var关键字来定义常量.
3.event.x与event.y问题
说明:IE下,event对象有x,y属性,但是没有pageX,pageY属性;Firefox下,event对象有pageX,pageY属性,但是没有x,y属性. 解决方法:使用mX(mX = event.x ? event.x : event.pageX;)来代替IE下的event.x或者Firefox下的event.pageX.
4.window.location.href问题
说明:IE或者Firefox2.0.x下,可以使用window.location或window.location.href;Firefox1.5.x下,只能使用window.location. 解决方法:使用window.location来代替window.location.href.