这段js放在head中
复制代码 代码如下:
//点击当前选中行的时候设置当前行的颜色,同时恢复除当前行外的行的颜色及鼠标事件
function selectrow(target)
{
var stable = document.getelementbyid(servicelisttable)
for(var i=1;i{
if (stable.rows[i] != target) //判断是否当前选定行
{
stable.rows[i].bgcolor = #ffffff; //设置背景色
stable.rows[i].onmouseover = resumerowover; //增加onmouseover 事件
stable.rows[i].onmouseout = resumerowout;//增加onmouseout 事件
}
else
{
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的的onmouseover事件配套调用函数
function resumerowover()
{
rowover(this);
}
//恢复tr的的onmouseout事件配套调用函数
function resumerowout()
{
rowout(this);
}
关于最后两个函数resumerowover和resumerowout为什么这样写参考我之前写的通过js给页面元素添加事件
对应的表格html
复制代码 代码如下:
服务事项
n
状态
办结
资料
相关内容
相关内容
相关内容
相关内容