warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\inetpub\Websites\DevGuru\www\includes\common.inc(1762) : eval()'d code on line 1.

JavaScript » Objects » Anchor

Syntax:
String.anchor(nameAttribute)

An Anchor object is a place in a document that is the target of a hypertext link. There are two ways of creating it: by calling the String.anchor method or by using the HTML 'A' tag. Each of these tags that have a NAME attribute is placed by the JavaScript engine in an array in the document.anchors property. An Anchor object can then be accessed by indexing this array. The former uses code to produce the anchor using the anchor method along with the document.write or document.writeln method.

The Anchor object inherits the watch and unwatch methods from Object, neither of which is supported by Microsoft JScript.
 
NOTE:
 
If the Anchor object is also a Link object, it'll have entries in both the anchors and links arrays.

Examples

Code:
var mystring = "INDEX OF BOOKS"
document.write(mystring.anchor("book_anchor"))
Explanation:

This example creates an anchor called 'book_anchor' on the string 'INDEX OF BOOKS'

Code:
<A NAME="book_anchor">INDEX OF BOOKS</A>
Explanation:

Using the HTML 'A' tag, you can do exactly the same as the above as like this.

Properties

constructor

Syntax: Object.constructor

This specifies a function to create an object's property and is inherited by all objects from their prototype.

prototype

Syntax: Object.prototype.name = value

This allows the addition of properties and methods to any object.

Methods

eval

Syntax: Object.eval(string)

The eval method is deprecated as a method of Object, but is still used as a high level function. It evaluates a string of JavaScript in the context of an object.

toSource

Syntax: Object.toSource()

The toSource method returns a literal representing the source code of an object. This can then be used to create a new object.

toString

Syntax: Object.toString()

The toString method returns a string representing a specified object.

unwatch

Syntax: Object.unwatch(property)

This method removes a watchpoint set for an object and property name with the watch method.

valueOf

Syntax: Object.valueOf()

This method returns a primitive value for a specified object.

watch

Syntax: Object.watch(property, handlerfunction)

This method adds a watchpoint to a property of the object.

See Also: