动态给table添加行点击事件

window.onload = function () {
            
            var trs = document.getElementsByTagName('tr');
            for (let j = 0; j < trs.length; j++) {
                trs[j].onclick = function(){
                    alert(this.getAttribute("tid"));
                }
                
            }

}; 

 


版权声明:本文为weixin_42787326原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。