Share on Google+Share on Google+

JavaScript link

This page discusses - JavaScript link

JavaScript link


In this section, you will learn about the text property of Link object in JavaScript.

JavaScript's Link object has the property text which allow the user to get the text value of the link. Here we have used this property with the document.links[0]. To invoke this property from the function, we have created a checkbox, which when clicked, displays the alert box showing the text value of the link.

Here is the code:

<h2>Text property of the Link object</h2>
<script language="JavaScript">
function getText(){
<input type="checkbox" onclick="getText()">
Click the checkbox to get the text value of the link.
<a href="">Welcome to RoseIndia</a>

Output will be displayed as:

On clicking the checkbox, you will get the text value of link:

Download Source Code:



Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

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.

Discuss: JavaScript link  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image