Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Javascript Javascriptexamples JavaScript Change link

Related Tutorials


 
 

Share on Google+Share on Google+

JavaScript Change link

Advertisement
This page discusses - JavaScript Change link

JavaScript Change link's text

        

In this section, you will learn how to change the link's text in JavaScript.

The modification of HTML code is quite simple. Now to modify the link's text, we have created a link that dynamically changes when you pass the mouse pointer over it. The JavaScript property innerHtml allows you to change your text. Therefore when you pass the mouse over the text link, the onMouseOver event occurs which shows the text 'RoseIndia' and when you release the mouse, onMouseOut event occurs which changes the text to 'Java Tutorials'.

Here is the code:

<html>
<h2>Change Link's Text</h2>
<a href="http://www.roseindia.net">
<div onMouseOver="this.innerHTML = 'RoseIndia'"
onMouseOut="this.innerHTML = 'Java Tutorials'">Java Tutorials</div></a>
</html>

Output will be displayed as:

On passing the mouse pointer over the link, it will change the text:

Download Source Code:

        

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 18, 2011

Related Tutorials

Discuss: JavaScript Change link  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com