<script>
function aa(b)
{
o=event.srcElement
if(o.tagName=="TBODY" || o.tagName=="TABLE") return
while(o.tagName!="TR")
o=o.parentElement
for(i=0;i<b.rows.length;i++)
b.rows[i].bgColor="white"
o.bgColor="blue"
}</script>
<table onclick="aa(this)">
<tr><td>aa</td></tr><tr><td>aa</td></tr><tr><td>aa</td></tr><tr><td>aa</td></tr><tr><td>aa</td></tr><tr><td>aa</td></tr>
</table>
function aa(b)
{
o=event.srcElement
if(o.tagName=="TBODY" || o.tagName=="TABLE") return
while(o.tagName!="TR")
o=o.parentElement
for(i=0;i<b.rows.length;i++)
b.rows[i].bgColor="white"
o.bgColor="blue"
}</script>
<table onclick="aa(this)">
<tr><td>aa</td></tr><tr><td>aa</td></tr><tr><td>aa</td></tr><tr><td>aa</td></tr><tr><td>aa</td></tr><tr><td>aa</td></tr>
</table>
解决方案 »
- 求救:如何向div中写入javascript,并有效执行
- CSS风格的变换
- 如何在htc中延时?
- 小白求助
- WORD另存为网页的问题
- clipboardData.getData("Text");
- jsp中如何把从http://activex.microsoft.com/controls/vb6/MSComCt2.cab下载的日期控件得到的日期传给一文本框?
- Help!!!!!!!!!!!!!!!!!!!!!!
- 求助:在chrome中将隐藏的表格显示出来后,却无法再次隐藏
- 删除(cookie、session、storage)都不能结束登录态
- 如何在弹出窗口提交后刷新父窗口(opener)?
- 如何用年月日生成6位随机数??(高分)
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>highLight</title>
<style>
td{ font-family: Courier New; font-size: 12px; text-align: center ;height:30;word-break:break-all;}
</style>
</head><body>
<script>
var h=null
function highLight(){
var e=event.srcElement;
if(e.tagName!="TD")return;
e=e.parentElement
if(!h)h=e;
h.style.backgroundColor='';
h=e;
h.style.backgroundColor='#3366cc'
}
function over(){
var e=event.srcElement;
if(e.tagName!="TD"||e.parentElement==h)return;
e=e.parentElement
e.style.backgroundColor='#d2e8ff'
}
function out(){
var e=event.srcElement;
if(e.tagName!="TD"||e.parentElement==h)return;
e=e.parentElement
e.style.backgroundColor=''
}
</script>
<div align="center">
<center>
<table onclick="highLight()" onmouseover="over()" onmouseout="out()" border="1" width="300" bordercolor="#000000" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
<tr>
<td width="33%">1</td>
<td width="33%">saucer</td>
<td width="34%">100</td>
</tr>
<tr>
<td width="33%">2</td>
<td width="33%">net_lover</td>
<td width="34%">99</td>
</tr>
<tr>
<td width="33%">3</td>
<td width="33%">masterz</td>
<td width="34%">98</td>
</tr>
<tr>
<td width="33%">4</td>
<td width="33%">meizz</td>
<td width="34%">97</td>
</tr>
<tr>
<td width="33%">5</td>
<td width="33%">pendai</td>
<td width="34%">96</td>
</tr>
</table>
</center>
</div></body></html>
var curr;
function changecolor(){
if(curr!=null)
document.all.table1.rows.item(curr).bgColor = "white";
curr = event.srcElement.parentElement.rowIndex
document.all.table1.rows.item(curr).bgColor = "blue";
}
</script>
<table id=table1 border=1 onclick=changecolor()>
<tr><td>This is Line 1</td></tr>
<tr><td>This is Line 2</td></tr>
<tr><td>This is Line 3</td></tr>
<tr><td>This is Line 4</td></tr>
</table>