IE6 不支持属性或子选择器,所以这根本不起作用。你在使用ie7-js吗?
好的,我现在明白了。这看起来像 IE 中的一个错误(使用div
and title
forth
并且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
似乎可以解决该错误。但是,在 Google 上找不到任何参考资料。