并非只有table tr之类不能用innerHTML =========================================================== The property is read/write for all objects except the following, for which it is read-only: COL, COLGROUP, FRAMESET, HTML, STYLE, TABLE, TBODY, TFOOT, THEAD, TITLE, TR.补充2个 ie6下背景图不被缓存..... 可以用document.execCommand("BackgroundImageCache", false, true); 解决.....
http://www.css88.com/archives/tag/ie6-bug
<input type="text" id="txt1"/>
</body>
<script type="text/javascript">
var cache={};
var $=function(id,forceNew) {
if(cache[id] &&!forceNew)
return cache[id];
return document.getElementById(id);
}
var d=new Date();
for(var i=0;i<20000;i++) {
$("txt1").value="哦"
}
document.write(new Date()-d);
document.write("<br/>");
var d2=new Date();
for(var i=0;i<20000;i++) {
$("txt1",true).value="哦"
}
document.write(new Date()-d2);
</script>
如下面的a[href$='.pdf'] {
padding-left: 18px;
background: transparent url(icon_pdf.gif) no-repeat center left;
}/* all A tags whose REL attribute equals pdf */
a[rel='pdf'] {
padding-left: 18px;
background: transparent url(icon_pdf.gif) no-repeat center left;
}
你定长20000. 这里就是节点操作消耗时间的比较不是循环耗时的比较了
IE6主要是针对内存访问没什么优化,寻址速度方面, 定长2W这个消耗就没比较性了
1、PNG图不透明,要烦死人
2、HTML注泽引起多余的文字出现
3、没有除链接外的hover属性
4、div不能遮盖select问题
5、不支持position:fixed也很头痛
~~~~~~~~
and so on
如果你把边界用 array.length ,IE6 寻址速度没优化,所以会很慢,慢是慢在寻址优化上面而不是从1循环到20000
而IE6这个操作测试下来确实比其他的快
我指的是循环优化,你做个空循环把你的那几个情况比较下就知道了
我尽量写详细点................
====================================
ie6下的bug还是很多的
如上面那位兄弟不说select的问题 说不定我都忘记写上去了
我知道一些 我说一下
1.ie6不table不能用innerHTML 未知错误。。
2.checkbox和radio 经过一些dom操作以后会会自动恢复成defaultChecked的状态
3.创建table的时候 在ie6下必须加tbody,不然看不见
4.给元素设置属性的时候 ie6下可以设置成dom元素,ie8,ff,chrome会自动把dom转成字符串
5.不能在元素加载的时候 进行document.appendChild()操作 会导致 ie停止运行(ie下的问题)
6.在获取样式的时候 如果是复合属性 如boder 是获取不到的........(好象所有的浏览器都这样..)
如果我想到了,或者在在网上看到了一些,我在补上..............
===========================================================
The property is read/write for all objects except the following, for which it is read-only: COL, COLGROUP, FRAMESET, HTML, STYLE, TABLE, TBODY, TFOOT, THEAD, TITLE, TR.补充2个
ie6下背景图不被缓存.....
可以用document.execCommand("BackgroundImageCache", false, true); 解决.....
在浏览器里输入:javascript:document.getElementsByTagName("table")[0].rows[0].cells[0].innerHTML='';void(0);你就没头像啦,顶层的
创建input的时候 type定义必须在添加在父元素之前(只在ie6,ff,chrome下测试了, ff,chrome是对的)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<body>
<input name="" type="text" /><input name="" type="button" />
<script type="text/javascript">
function C(e,p,fn){
var o = document.createElement(e);
p.appendChild(o);//这2行颠倒位置看看
fn&&fn(o);//
}
window.onload = function(){
C('input',document.body,function(o){
o.type = "button";
o.value='按牛吗'
})
}
</script>
</body>
</html>当没有背景的div设置成浮动position:absolute,且不设置背景,
里面的onclick无法触发(onmousedown),只能在边框上触发,(只在ie6,ff,chrome下测试了, ff,chrome是对的)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<body>
<div style="height:100px; width:100px; border:1px solid #FF0000; position:absolute" onclick="alert('a')"></div>
<script type="text/javascript"></script>
</body>
</html>当有些元素属性读不出来
解决方法(用元素集合来读取..不知是否对所有属性有效)(ff,chrome下正常)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<style type="text/css">
.a{
height:50px;
width:400px;
background-color:#0000FF;
margin:10px;
}
</style>
</head>
<body>
<form action="/post/" method="post" id="form1" name="form1">
<input type="hidden" name="action" id="action" value="aaaaaaaaa" />
</form>
<script language="JavaScript">
<!--
alert(document.form1.getAttribute('action'));
alert(document.form1.attributes["action"].value)
alert(document.form1.action.value);
//-->
</script>
</body>
</html>还看到一些如创建元素后不能马上获取属性,要setTimout 0秒,因为原因看的不大懂,就不记录上去了