GetElementById and null - why?
The required DOM does not load when the script is executed. Either move it down (below href), or define it as follows:
window.onload = function () { document.getElementById("someID").onclick = function(){ alert("Yahooo"); } } window.onload will be called when the page is fully loaded.
Since this element does not yet exist when the script is executed, the document has not yet been displayed. Either run the script in the script block after the corresponding HTML code, or use the "document on ready" event handler - preferably from something like jQuery .ready() or native window.onload .