Javascript language

adplus-dvertising
link() Method in JavaScript
Previous Home Next

The link() method is used to display a string as a hyperlink. This method returns the string embedded in the <a> tag, like this: <a href="url">string</a>

Syntax:

string.link(url)

Example:

<html>
<body>
<script language="javascript">
function new_url()
{
var myS = new String('r4r.co.in Home Page'); 
document.write(myS.link('http://www.r4r.co.in/'));
}
</script>
<button onclick="new_url()">Create a link from</button>
</body>
</html>

Output:

Previous Home Next