new Image() option
style & src & onclick
1 2 3 4 5 6 7 | // JavaScript Code <script> img = new Image(); img = "200px"; img.src = 'blah.png'; img.style.height = "140px"; img.onclick = function() { alert('hi'); }; </script> |
thanks~!
by doctorson0309, platformaker
reference : https://stackoverflow.com/questions/3316207/add-onclick-event-to-newly-added-element-in-javascript
reference : http://ontheinfo.com/2396#comment-9787