191
rated 0 times
[
195]
[
4]
/ answers: 1 / hits: 158158
/ 15 Years ago, fri, june 19, 2009, 12:00:00
My goal is to change the onclick
attribute of a link. I can do it successfully, but the resulting link doesn't work in ie8. It does work in ff3.
For example, this works in Firefox 3, but not IE8. Why?
<p><a id=bar href=# onclick=temp()>click me</a></p>
<script>
doIt = function() {
alert('hello world!');
}
foo = document.getElementById(bar);
foo.setAttribute(onclick,javascript:doIt(););
</script>
More From » onclick