sorry, this is rightdocument.getElementById('t2').parentElement.parentElement.rows[0].style.background = 'red';
2.you make a mistake."view" --> "view source" , can see the source code, but it is always the cache content.if you wana to realize your purpose, you should click the button "edit" in the toolbar, that is the right operation
我的
<table>
<tr><td>1</td></tr>
<tr id=t2 class="r"><td>a</td></tr>
</table>
实际上也没有id,应该是这样的
<table>
<tr><td>1</td></tr>
<tr class="r"><td>a</td></tr>
</table>
,关于源文件那个问题。三角猫的答案我不满意。
<tr><td style="padding:5px 10px">2004年6月A版 <div style="width:100%;text-align:right">
<span class="gray">(2004.00,<span class="hit">436</span>)</span>
<a href="show.aspx?id=3394&cid=29" target="_blank" >[查看全文]</a> </div></td></tr>这里给出两行,类似的行还有30几行,怎么能把所有像第二行一样没有class="summary-title"的行的行高设置成30,color设置成red。
当然还是必须用javascript
<script>
var TBobj = document.all.tags("table")[0]
var TDobj = TBobj.all.tags("td")
for( var i = 0 ; i < TDobj.length ; i++){
if( TDobj[i].className == "" ){
TDobj[i].style.height = 30
TDobj[i].style.background = "red"
}
}
</script>
var TDobj = document.getElementsByTagName("td") for( var i = 0 ; i < TDobj.length ; i++){
if( TDobj[i].className!="summary-title" ){
TDobj[i].style.height = 30
TDobj[i].style.backgroundColor = "red"
}
}
</script>