11/23/10

Javascript Smarter Links

Here is a piece of code which when you use will make your link in the website SMARTER.


This piece of code i used it during my internship and it was well appreciated by the company as it made the user know that the content that they are trying to visit is out of their domain.



*****************##****************
The JS Code:

window.onload = initAll;



function initAll() {
document.getElementById("redirect").onclick = clickHandler;
}


function clickHandler() {
if(this.toString().indexOf("xyz")<0){>


style="font-weight: bold;">
alert("We are not responsible for the content of pages outside our site.");


}
}


CODE Usage:












Hey, check out my Java Web site.










*****************##****************


Use and enjoy the the smarter links on your website and make them look professional.


SHARE THIS POST:

0 comments:

Post a Comment