JavaScript String - anchor() Method
Description
This method creates an HTML anchor that is used as a hypertext target.
Syntax
Its syntax is as follows −
string.anchor( anchorname )
Attribute details
anchorname − Defines a name for the anchor.
Return Value
Returns the string having the anchor tag.
Example
Try the following example.
<html>
<head>
<title>JavaScript String anchor() Method</title>
</head>
<body>
<script type = "text/javascript">
var str = new String("Hello world");
alert(str.anchor( "myanchor" ));
</script>
</body>
</html>
Output
<a name = "myanchor">Hello world</a>
javascript_strings_object.htm