<!--简单的例子-->
<table>
<tr style="background-color: #CCFFFF" onclick="this.style.backgroundColor='#FFECFC'">
<td><a href="#">自己1</a></td>
<td><a href="#">自己2</a></td>
</tr>
</table>
<table>
<tr style="background-color: #CCFFFF" onclick="this.style.backgroundColor='#FFECFC'">
<td><a href="#">自己1</a></td>
<td><a href="#">自己2</a></td>
</tr>
</table>
<tr onclick='this.bgColor="#336699"' width=20%>
<td><a href="#">111111</a></td>
</tr>
</table>
<table border=1 width=20%>
<tr onclick='this.bgColor="#336699"' width=20%>
<td><a href="http://www.163.com" target=frm2>111111</a></td>
</tr>
</table>
////////////////////////////////
right.htm:
<html>
<head>
</head>
<body>
This is right.htm
</body>
</html>
//////////////////////////////////
main.htm:
<frameset cols="20%,*">
<frame src="left.htm"></frame>
<frame src="right.htm" name="frm2"></frame>
</frameset>
你的方法可以的!如果有很多行的话,怎么能让点击的行变背景色为指定颜色,其他行的背景色变没或透明?
如果麻烦的话,直接告诉我在javascript里怎么得到每行,这样我就可以设置它的属性了:)
<script language="JavaScript">
function doBackC(id)
{
var i,o;
for (i=1;i<=3;i++)
{
o=document.getElementById('trid'+i);
if (i==id)
{
o.style.backgroundColor='#FFECFC';
}
else
{
o.style.backgroundColor='';
}
}
}
</script>
<iframe name="if_frm" width="100%" height="320" src="about:blank"></iframe>
<table align="center" width="45%" border="1" bgcolor="#FFFFE8">
<tr id="trid1">
<td><a href="http://www.pal.org.cn" target="if_frm" onclick="doBackC(1)">中国仙剑联盟</a></td>
</tr>
<tr id="trid2">
<td align="center"><a href="http://paltv.126.com" target="if_frm" onclick="doBackC(2)">仙剑TV网</a></td>
</tr>
<tr id="trid3">
<td align="right"><a href="http://palhero.126.com" target="if_frm" onclick="doBackC(3)">仙剑奇侠传英雄网</a></td>
</tr>
</table>