I have a link on an html page and it has id="redirect"
and this is in (script.js)
window.onload = initAll();
function initAll(){
document.getElementById("redirect").onclick = clickHandler;
}
function clickHandler(){
alert("Sure!");
return true;
}
I get an error
SCRIPT5007: Unable to set value of the property 'onclick': object is null or undefined
I tried this in (IE9, IE8, chrome, Firefox 4.0.1) and still not working, please help
source
share