Latest web development tutorials

JavaScript link () method

String Object Reference JavaScript String Object

Definition and Usage

link () method for the string appears as a hyperlink.

This method returns a string <a> add tags, as follows:

<a href="url"> string </a>

grammar

string.link(url)

参数 描述
url Required. The URL to link to


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support link () method


Examples

Examples

The string "! Free Web Building Tutorials" Display as a link:

<script>

var str = "Free Web Building Tutorials!";
document.write(str.link("http://www.w3cschool.cc"));

</script>

try it"


String Object Reference JavaScript String Object