是否可以在不破坏后代事件侦听器的情况下追加到innerHTML?
onclick
alert()
.
innerHTML
onclick
<html> <head> <script type="text/javascript"> function start () { myspan = document.getElementById("myspan"); myspan.onclick = function() { alert ("hi"); }; mydiv = document.getElementById("mydiv"); mydiv.innerHTML += "bar"; } </script> </head> <body onload="start()"> <div id="mydiv" style="border: solid red 2px"> <span id="myspan">foo</span> </div> </body></html>
HUX布斯
三国纷争