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 firefox3, 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>