文章列表
IE和Firefox(火狐)在JavaScript方面的不兼容及统一方法总结如下:
1.兼容firefox的 outerHTML,FF中没有outerHtml的方法。
if (window.HTMLElement) {
HTMLElement.prototype.__defineSetter__("outerHTML",function(sHTML) {
var r=this.ownerDocument.createRange();
r.setStartBefore(this);
var df=r.createContext ...
今天在学习中遇到了在ie中设置class属性值的bug,现写出来与大家分享,一起共勉,如有错漏望不吝指正。
如:
elm.setAttribute('class', 'className');
在IE6/7中样式“className”并没有起作用,虽然使用elm.getAttribute('class')是可以获取到“className”。
后来上网查了一些资料,发现了在ie中其实还有一部分属性也会有这样的问题,像for属性
<label>姓名:</label>
<input type="checkbox" id="na ...