JavaScript link () method
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
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>
var str = "Free Web Building Tutorials!";
document.write(str.link("http://www.w3cschool.cc"));
</script>
try it"
JavaScript String Object