Latest

recent

JavaScript anchor() Method

Definition and Usage

The anchor() method is used to create an HTML anchor.

Syntax

stringObject.anchor(anchorname)

Parameter Description
anchorname Required. Defines a name for the anchor


Example

In this example we will add an anchor to a text:

<script type="text/javascript">
var txt="Hello world!";
document.write(txt.anchor("myanchor"));
</script>

The code above could be written in plain HTML, like this:

<a name="myanchor">Hello world!</a>
JavaScript anchor() Method Reviewed by 1000sourcecodes on 02:19 Rating: 5
Powered by Blogger.