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.
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.
The link() method is used to display a string as a hyperlink.
Parameter - urlCode:stringObject.link(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>
JavaScript link method
JavaScript link method is used to create a hyperlink for any string.
Syntax:
Where linkURL is the URL of the web page to which we have to referenced and it also can refer to the JavaScript.Code:stringObject.link( linkURL );
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>
Bookmarks