如何动态的改变Html中tr行的背景颜色
1个回答
展开全部
<script>
function cc(a){
a.style.backgroundColor= "red "
}
</script>
</HEAD>
<BODY>
<TABLE id= "table1 " border= "1 ">
<TR onclick= "cc(this) ">
<TD> aaaa </TD>
<TD> <a href= "# " > 111111 </a> </TD>
</TR>
<TR onclick= "cc(this) ">
<TD> bbbbb </TD>
<TD> <a href= "# " onclick= "InsertRow(); "> 22222 </a> </TD>
</TR>
<TR onclick= "cc(this) ">
<TD> ccccc </TD>
<TD> <a href= "# " onclick= "InsertRow(); "> 33333 </a> </TD>
</TR>
<TR onclick= "cc(this) ">
<TD> dddddd </TD>
<TD> <a href= "# " onclick= "InsertRow(); "> 444444 </a> </TD>
</TR>
</TABLE>
function cc(a){
a.style.backgroundColor= "red "
}
</script>
</HEAD>
<BODY>
<TABLE id= "table1 " border= "1 ">
<TR onclick= "cc(this) ">
<TD> aaaa </TD>
<TD> <a href= "# " > 111111 </a> </TD>
</TR>
<TR onclick= "cc(this) ">
<TD> bbbbb </TD>
<TD> <a href= "# " onclick= "InsertRow(); "> 22222 </a> </TD>
</TR>
<TR onclick= "cc(this) ">
<TD> ccccc </TD>
<TD> <a href= "# " onclick= "InsertRow(); "> 33333 </a> </TD>
</TR>
<TR onclick= "cc(this) ">
<TD> dddddd </TD>
<TD> <a href= "# " onclick= "InsertRow(); "> 444444 </a> </TD>
</TR>
</TABLE>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询