zoukankan      html  css  js  c++  java
  • 动态添加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=""; }
  • 相关阅读:
    🍖JS函数
    🍖JS流程控制
    🍖JS运算符介绍
    🍖JS数值类型与字符串类型的内置方法
    多态
    property装饰器
    封装
    组合
    继承&派生 属性查找
    继承与派生
  • 原文地址:https://www.cnblogs.com/icejd/p/945855.html
Copyright © 2011-2022 走看看