I tried doing this but it didn't seem to work:
window.onload = initAll;
function initAll(){
document.getElementsByTagName('a').onclick = clickHandler;
}
function clickHandler(){
if(this.toString().indexOf("localhost") < 0) {
confirmation = confirm("You are now leaving http://soso.com. Please click 'ok' to continue to this site, or 'cancel' to stay in http://soso.com");
if (confirmation == false){
return false;
}
}
}
I know I can getElementById and that works, but it doesnt work this way. Any help would be appreciated.
Thanks!