JavaScript anchor () method
Definition and Usage
anchor () method is used to create an HTML anchor.
This method returns a string <a> add tags, as follows:
<a name="anchorname"> string </a>
grammar
string.anchor(name)
参数 | 描述 |
---|---|
name | Required. The name of the anchor |
Browser Support
All major browsers support anchor () method.
Examples
Examples
Create an HTML anchor:
<script>
var txt = "Chapter 10";
txt.anchor("chap10");
alert(txt.anchor("chap10"));
</script>
var txt = "Chapter 10";
txt.anchor("chap10");
alert(txt.anchor("chap10"));
</script>
try it"
JavaScript String Object