var setTable = function(table_id) {
var table = document.getElementById(table_id);
var rows = table.getElementsByTagName("tr");
for (i = 1; i < rows.length; i++) {// 0 is start
var srcBgColor = null;//rows[i].style.backgroundColor;
rows[i].onmouseover = function() {
srcBgColor = this.style.backgroundColor;
this.style.backgroundColor = 'red';
};
rows[i].onmouseout = function() {
// this.style.backgroundColor = '';
this.style.backgroundColor = srcBgColor;
};
// this.className='selectedRow'
rows[i].onclick = function() {
//var cell = this.getElementsByTagName("td")[1];// 0 is start
//var entryId = cell.firstChild.nodeValue;
var entryId = this.cells[1].innerText;
location.href = '${basePath}bill/bill!retrieveByEntryId.action?bill.entryId=' + entryId;
this.style.cursor = "wait";
}
}
}
window.onload = function() {
init();
setTable("bm");
}
js设置表格行的单击、鼠标移动事件,光棒效果
最新推荐文章于 2020-03-02 20:44:23 发布