首页 »Javascript教程 » js高亮:比较高效的表格行背景变色及选定高亮JS »正文js高亮:比较高效的表格行背景变色及选定高亮JS来源: 发布时间:星期六, 2008年12月13日 浏览:108次 评论:0
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 这段JS放在head中view plaincopy to clipboardpr ![]() //点击当前选中行 ![]() ![]() ![]() ![]() ![]() function selectRow(target) { var sTable = document.getElementById("ServiceListTable") for(var i=1;i<sTable.rows.length;i ![]() ![]() ![]() { ![]() { sTable.rows[i].bgColor = "#ffffff"; //设置背景色 sTable.rows[i].onmouseover = resumeRowOver; //增加onmouseover 事件 sTable.rows[i].onmouseout = resumeRowOut;//增加onmouseout 事件 } ![]() { sTable.rows[i].bgColor = "#d3d3d3"; sTable.rows[i].onmouseover = ""; //去除鼠标事件 sTable.rows[i].onmouseout = ""; //去除鼠标事件 } } } //移过时tr ![]() function rowOver(target) { target.bgColor='#e4e4e4'; } //移出时tr ![]() function rowOut(target) { target.bgColor='#ffffff'; } //恢复tr ![]() ![]() ![]() ![]() function resumeRowOver ![]() { rowOver(this); } //恢复tr ![]() ![]() ![]() ![]() function resumeRowOut ![]() { rowOut(this); } //点击当前选中行 ![]() ![]() ![]() ![]() ![]() function selectRow(target) { var sTable = document.getElementById("ServiceListTable") for(var i=1;i<sTable.rows.length;i ![]() ![]() ![]() { ![]() { sTable.rows[i].bgColor = "#ffffff"; //设置背景色 sTable.rows[i].onmouseover = resumeRowOver; //增加onmouseover 事件 sTable.rows[i].onmouseout = resumeRowOut;//增加onmouseout 事件 } ![]() { sTable.rows[i].bgColor = "#d3d3d3"; sTable.rows[i].onmouseover = ""; //去除鼠标事件 sTable.rows[i].onmouseout = ""; //去除鼠标事件 } } } //移过时tr ![]() function rowOver(target) { target.bgColor='#e4e4e4'; } //移出时tr ![]() function rowOut(target) { target.bgColor='#ffffff'; } //恢复tr ![]() ![]() ![]() ![]() function resumeRowOver ![]() { rowOver(this); } //恢复tr ![]() ![]() ![]() ![]() function resumeRowOut ![]() { rowOut(this); } 关于最后两个 ![]() ![]() 对应 ![]() ![]() <table width="100%" border="0" cellspacing="0" cellpadding="0" id="ServiceListTable"> <tr> <th>服务事项</th> <th>N</th> <th>状态</th> <th>办结</th> <th>资料</th> </tr> <tr _disibledevent=447 0
相关文章读者评论发表评论 |