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:

Related Posts:

  • Working with DOM , nodes and Objects (part 2) : Deleting Nodes As my last post of DOM was on Adding nodes here is a post that will help you in deleting the last entered node. ie DELETING Nodes. *----------------------*----------------------*---------------------* HTML CODE: … Read More
  • Working with DOM,nodes and Objects : Inserting Nodes (part 3) This Post is a continuation of my previous posts ie Adding Nodes and Deleting Nodes. IN this post i am tell how you can add nodes between any two nodes. *----------------------*----------------------*----------------… Read More
  • Handling Keyboard Events in Javascript Guys if u have seen the moving of pictures on pressing a key in FB , FLICKR etc. Can also be done by you all now. The code for Handling the keyboard button press etc is shown below **********************##**************… Read More
  • 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… Read More
  • Detecting a Cookie Here is a piece of code that can help people detect cookies. Cookies play an important part in the website. *****************#####***************** JS Code: window.onload = showCookies; function showCookies() {  &nb… Read More

0 comments:

Post a Comment