Development| HTML| JavaScript| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
JavaScript link method 
 

JavaScript link method is used to create a hyperlink for any string. While we use the link method it creates hyperlink programmatically.

 

JavaScript link method

                         

JavaScript link method is used to create a hyperlink for any string. While we use the link method it creates hyperlink programmatically. This link becomes the element in the array of the document object.

 

 

 

 

 

Syntax:

 stringObject.link( linkURL );

where linkURL is the URL of the web page to which we have to referenced and it also can refer to the JavaScript.

Description of code:

In the following code we have a button and it calls the function createLink() as defined in the JavaScript code within tag <script></script>.

var string = new String('Roseindia Technologies');

Above lines of code creates a string variable and we will be creating link for this string. 

string.link('http://www.roseindia.net');

Above line of code will create a link like that <A HREF="http://www.roseindia.net">RoseIndia Technologies</A>. Here is the full example code for the link method example as given below:

<html>
<body>
<script type="text/javascript" >
function createLink(){
var string = new String('Roseindia Technologies'); 
document.getElementById("div1").innerText = string.link('http://www.roseindia.net');
}
</script>
<center>
<div align="center">
<table border="0" width="45%" bgcolor="#800080">
<tr>
<td width="100%" align="center">
<p align="center"><font face="Comic Sans MS" size="7" color="#FFFFFF">link method</font></td>
</tr>
</table>
</div>
<div id="div1" style="style=width:50%; height:50;background-color:#c9c9ad;"></div>
<input type="button" onclick="createLink();" value="create a link of RoseIndia" />
</body>
</html>

Output :

Click on the button "create a link of RoseIndia" to create link .

Given below is the link from where you can download the full source code.

Download Source Code

                         

» View all related tutorials
Related Tags: java javascript c date script object method ip value set to ear e can use as m ca j me

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.