[Chapter 21] Reference: String.link()
Author: David Flanagan
Date: Fri Aug 29 11:20:03 1997

#

| Chapter 21 JavaScript Reference |

# String.link() Method

## Name

String.link() Method---add a hypertext link to a string

## Availability

Navigator 2.0, Internet Explorer 3.0

## Synopsis

    string.link(href)

### Arguments

`href`

  The URL target of the hypertext link that is to be added to the string. This string argument specifies the value of the `HREF` attribute of the `<A>` HTML tag.

### Returns

A copy of `string`, enclosed within `<A HREF="``href``">` and `</A>` HTML tags.

## Example

The following two JavaScript fragments evaluate to identical strings:

    'Section 1-1'.link('ch01#sect1')
    '<A HREF="ch01#sect1">Section 1-1</A>'

## See Also

"String", "String.anchor()"

String.length |  | String.prototype