鼠标经过tr时,更改tr当前背景颜色
发布时间:2023-09-20 15:44:57 所属栏目:教程 来源:
导读: 代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>鼠标经过给tr换颜色</title>
</head>
<body>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>鼠标经过给tr换颜色</title>
</head>
<body>
代码如下: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GBK"> <title>鼠标经过给tr换颜色</title> </head> <body> <table align="center" width="100%" border="1" cellspacing="1" cellpadding="1" > <tr style="cursor:hand " onmousemove="changeTrColor(this)"> <td align="center">1</td> <td height="20"> 123</td> <td height="20"> abvx</td> <td height="20"> 465465</td> <td height="20">546654654</td> </tr> <tr style="cursor:hand " onmousemove="changeTrColor(this)"> <td align="center">1</td> <td height="20"> 123</td> <td height="20"> abvx</td> <td height="20"> 465465</td> <td height="20">546654654</td> </tr> <tr style="cursor:hand " onmousemove="changeTrColor(this)"> <td align="center">1</td> <td height="20"> 123</td> <td height="20"> abvx</td> <td height="20"> 465465</td> <td height="20">546654654</td> </tr> </table> <script type="text/javascript"> function changeTrColor(obj){ var _table=obj.parentNode; for (var i=0;i<_table.rows.length;i++){ _table.rows[i].style.backgroundColor=""; } obj.style.backgroundColor="blue"; } </script> </form> </body> </html> (编辑:聊城站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐