JavaScript anchor() method
JavaScript anchor() Method
Definition and usage
anchor() method is used to create HTML anchors .
This method returns a string with the <a> tag, as shown below:
<a name="anchorname">string</a>
Syntax
string.anchor(name)
Description | |
---|---|
Required. The name of the anchor |
View Browser SupportAll major browsers support the anchor() method.
Instance
Instance
Run Instance»Click "Run Instance" Button to view online examples
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <script> var txt="Chapter 10"; txt.anchor("chap10"); alert(txt.anchor("chap10")); </script> </body> </html>
Run Instance»Click "Run Instance" Button to view online examples