Archive

Posts Tagged ‘IE’

Javascript的IE和Firefox兼容解决方案汇总

December 25th, 2008

1:innerText

IE支持,FIREFOX不支持
解决办法:用innerHTML,2种浏览器都识别innerHTML

2:document.createElement
document.appendChild
在往表里插入行时
FIREFOX支持,IE不支持
解决办法:把行插入到TBODY中,不要直接插入到表

3:setAttribute(’’style”,”color:red;”)
FIREFOX支持(除了IE,现在所有浏览器都支持),IE不支持
解决办法:不用setAttribute(’’style”,”color:red”)
而用object.style.cssText = ”color:red;”(这写法也有例外)
最好的办法是上面种方法都用上,万无一失 ^_^
4:class
setAttribute(”class”,’’styleClass”)
FIREFOX支持,IE不支持(指定属性名为CLASS,IE不会设置元素的CLASS属性,相反只使用SETATTRIBUTE时IE自动识别CLASSNAME属性)
解决办法:
setAttribute(”class”,’’styleClass”)
setAttribute(”className”,’’styleClass”)
2种都用上(注:IE和FF都支持object.className) Read more…

undecided , ,

IE和Firefox下event的差异

June 15th, 2008

如果在使用javascript的时候涉及到event处理,就需要知道event在不同的浏览器中的差异,因为javascript的事件模型有三种,它们分别是NN4、IE4+和W3C/Safari;这也造成了在不同的浏览器中处理event的差异,这里结合一些零碎的代码来说明如何做到event在 IE4+和Firefox下的正常工作。 Read more…

Docu~ , , ,

解析CSS(JS)时IE7 与IE6的区别; IE6 7 Firefox CSS hacks

April 23rd, 2007

区别不同浏览器:FF,IE7,IE6 的CSS hack写法:

background:orange;*background:green !important;*background:blue;

background:orange;*background:green;_background:blue;

注:E6支持下划线,IE7和firefox均不支持下划线。
IE都能识别*;标准浏览器(如FF)不能识别*;
IE6能识别 * 和 下划线,但不能识别 !important,
IE7能识别 * 和 !important,但不能识别下划线;
FF能识别!important,但不能识别* 和 下划线;

IE7 与IE6的区别:
Read more…

Docu~ , , , ,