IE6不支持属性或子选择器,所以这根本不应该工作。你在使用ie7-js吗?
OK,我现在看到。这看起来像IE中的一个错误(使用div
和title
,对于th
和sortOrder
有同样的问题)。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style>
th[sortOrder="0"] {color:red}
th[sortOrder="1"] {color:blue}
</style>
<script>
function changeSortOrder() {
// swap the orders so that blue is actually red and vice versa
document.getElementById("hdr0").setAttribute("sortOrder","1");
document.getElementById("hdr1").setAttribute("sortOrder","0");
//document.getElementById("hdr0").innerHTML += "";
//document.getElementById("hdr1").innerHTML += "";
}
</script>
</head>
<body onload="changeSortOrder()">
<table class="SearchCustomerResults">
<thead><tr>
<th sortOrder="0" id="hdr0">red</th>
<th sortOrder="1" id="hdr1">blue</th>
</tr></thead>
</table>
</body>
</html>
修饰innerHTML
的线条似乎解决的bug。虽然在Google上找不到任何引用。
对不起,我是用IE7的。但问题仍然存在 – erikkallen 2009-04-20 11:52:37