1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23:
<img id="testimg" onClick="openNewWindowA();"> <script> var oldevent = null; function newOnClickEvent(e) { // begin of newOnClickEvent implementation // ... // end of newOnClickEvent implementation if (typeof oldevent == 'function') oldevent(e); return 0; } function changeOnClickEvent(imgObj) { var iobj = (typeof imgObj == "string") ? document.getElementById(imgObj) : imgObj; oldevent = iobj.onClick; iobj.onClick = newOnClickEvent; } // call to changeOnClickEvent("testimg"); </script>