The needed DOM is not loaded when the script is executed. Either move it down (below the href) or define it like this:
window.onload = function () {
document.getElementById("someID").onclick = function(){
alert("Yahooo");
}
}
window.onload will be called when the page is completely loaded.