<!--简单的例子-->
<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>
解决方案 »
- Extjs 简单问题 但是没整出来 好心的人进来看看吧 在线等
- 关于“document.write”的奇怪问题
- 怎么隐藏或删除百度地图里的label啊?
- 在TD中动态创建和删除select(应用于调查表),能实现吗,要求如下
- 求助:js问题
- 有办法把一个javascript的二维数组传递到asp吗?
- 如何遍历FORM中所有的CHECKBOX,CHECKBOX数量不定,是动态生成的?
- 我郁闷,IE已经升级到6.0了,为什么不能打开桢结构?高手指教
- 各位大虾,Javascript 中怎样用ADO,请举个例子看看,必重谢!!!!
- 我想循环输出信息,但总是刷新一次,就把整个循环写到浏览器上去,我要的是刷新一次浏览器显示新的内容而不是新加内容
- 正则表达式-“匹配大括号里面的内容”怎么写?
- 我的一个页面中有三个frame,请问如何在其中一个frame中点击连接,关闭窗口。然后整个页面就关闭了.
<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>