AspNet技术

.Net平台 + C#语言 + Microsoft SQL Server 开发互联网之web应用!

[原]鼠标放进去行变色

window.onload = function () {
            var trs = document.getElementById('tb').getElementsByTagName('tr');
            for (var i = 0; i < trs.length; i++) {
                trs[i].onmouseover = function () {
                    this.style.backgroundColor = 'red';
                };
                trs[i].onmouseout = function () {
                    this.style.backgroundColor = '';
                }
            }
        }
<table id="tb" border="1" cellpadding="0" cellspacing="0" style=" cursor:pointer;">
        <tr>
            <td>
            写两遍 写两遍 写两遍
            </td>
               <td>
            写两遍 写两遍 写两遍
            </td>
               <td>
            写两遍 写两遍 写两遍
            </td>
        </tr>
         <tr>
            <td>
            写两遍 写两遍 写两遍
            </td>
               <td>
            写两遍 写两遍 写两遍
            </td>
               <td>
            写两遍 写两遍 写两遍
            </td>
        </tr>
        </table>

posted on 2014-04-26 22:17  Seves2015  阅读(123)  评论(0编辑  收藏  举报

导航