<!DOCTYPE html><html><head><meta charset="UTF-8"><title></title></head><body><div class="btn1">dds</div><div class="btn1">dds</div><div class="btn1">dds</div><div class="btn1">dds</div><script>window.onload = function(){ var btns = document.getElementsByTagName('div') for(var i = 0;i<btns.length;i++){ btns[i].click = function(){ console.log('i'); this.innerHTML = "aaa"; } }}</script></body></html>
添加回答
举报
0/150
提交
取消