Results 1 to 4 of 4

Thread: example for link() method with javascript

  1. #1
    Join Date
    Jul 2009
    Posts
    1,179

    example for link() method with javascript

    Hi,

    I need to see a working example of link() method with javascript.
    If you guys can show me an example so that I can add it to my website too. I am not sure how to code. Since the coding part is out of my understanding.

    Thanks in advance.

  2. #2
    Join Date
    Oct 2008
    Posts
    75

    Re: example for link() method with javascript

    The link() method is used to display a string as a hyperlink.

    Code:
    stringObject.link(url)
    Parameter - url
    Description - Required. Specifies the URL to link to

    Example

    In this example "Free Web Tutorials!" will be displayed as a hyperlink:

    Code:
    <script type="text/javascript">
    
    var str="Free Web Tutorials!";
    document.write(str.link("http://www.w3schools.com"));
    
    </script>

  3. #3
    Join Date
    May 2008
    Posts
    44

    Re: example for link() method with javascript

    JavaScript link method

    JavaScript link method is used to create a hyperlink for any string.

    Syntax:

    Code:
    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.

  4. #4
    Join Date
    May 2008
    Posts
    24

    Re: example for link() method with javascript

    Javascript String - link() Method

    Code:
    <html>
    <head>
    <title>JavaScript String link() Method</title>
    </head>
    <body>
    <script type="text/javascript">
    
    var str = new String("Hello world");
    var URL = "http://www.mywebsite.com";
    
    alert(str.link( URL ));
    
    </script>
    </body>
    </html>

Similar Threads

  1. Method overriding versus method hiding in C#
    By ^MALARVIZHI^ in forum Software Development
    Replies: 4
    Last Post: 25-12-2010, 06:25 AM
  2. Replies: 6
    Last Post: 13-05-2010, 12:11 PM
  3. JavaScript - open link in same window using location.replace
    By Elizabeth Allen in forum Software Development
    Replies: 7
    Last Post: 13-05-2010, 12:08 PM
  4. Is it possible to call destroy() method within init() Method?
    By Level8 in forum Software Development
    Replies: 3
    Last Post: 10-12-2009, 08:36 AM
  5. What is method overriding and method overloading in java
    By beelow in forum Software Development
    Replies: 3
    Last Post: 17-11-2009, 08:20 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,136,909.35817 seconds with 16 queries