动态添加Html单元格时,事件怎么写?如mouseover事件

动态添加Html单元格时,事件怎么写?如mouseover事件
tr=Grid1.insertRow(Grid1.rows.length);
td=tr.insertCell();
td.innerText="a";
td=tr.insertCell();
td.innerText="b";
比如要在经过这一行时,怎么写mouseover事件?
======================================================

function add() {

tr=Grid1.insertRow();
 td=tr.insertCell();
 td.innerText="a";
td=tr.insertCell();
td.innerText="b";
tr.attachEvent('onmouseover',c1);
 tr.attachEvent('onmouseout',c2);
//document.all.Grid1.rows[0].onmouseover=c();
 }

function c1() { var t=event.srcElement.parentElement; t.style.backgroundColor="#dedede"; }

function c2() { var t=event.srcElement.parentElement; t.style.backgroundColor=""; }

111 222
原文地址:https://www.cnblogs.com/goody9807/p/132927.html