问个js给元素批量添加事件的问题

2025-03-11 10:50:14
推荐回答(3个)
回答1:

把document.getElementById(s).style.backgroundColor='red';修改为this.style.backgroundColor='red';

回答2:


document.getElementById(s).style.backgroundColor='red';
改为
this.style.backgroundColor='red';

回答3:

用jquery吧