How To Use String Object Anchor In JavaScript

In this article I am going to explain about String Object Anchor In JavaScript.
  • 1573

Use anchor() method in JavaScript

The anchor() method create a HTML anchor, and return a name value in JavaScript.

The anchor() method returns the string embedded in the <a> tag, like this:

<a name="anchorname">string</a>.\

All browsers support string object anchor() method.

Syntax

string.anchor(name)

Example

<!DOCTYPE html>

<html>

<body>

 

<script type="text/javascript">

 

    var txt = "Chapter 7";

    txt.anchor("chap7");

    alert(txt.anchor("chap7"));

 

</script>

 

</body>

</html>

Output1

 op1.jpg

Further Readings

You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.