The link method places an HTML anchor with an HREF attribute around the text in a String object.
Syntax
strVariable.link(linkstring)
"String Literal".link(linkstring)
The linkstring argument is the text that you want to place in the HREF attribute of the HTML anchor.
Return value
None
Example
Call the link method to create a hyperlink out of a String object. The following is an example of how the method accomplishes this:
<html> <head> <script language="JavaScript"> function linkTag() { var strVariable = "This is test link"; strVariable = strVariable.link("http://www.testonly.com"); return strVariable; } </script> </head> <body> <p> See how it work in Html <script language="JavaScript"> document.write(linkTag()); </script> </p> </body>
|
To run the code, paste it into JavaScript Editor, save as htm file format and click the Show Internal view button.
See also: anchor method, String Object methods, String Object properties |