JavaScript Reference :: Link

The easiest way to create a Link object is to get the HTML element using either the document method getElementById or getElementsByTagName to get a reference to an HTML anchor tag. Of course, you may also use createElement("a"), the link method of the string object, or grab one of the elements of the links property in the document object. Once you have the element, you can assign event handlers or modify the properties.

methods

object toSource()
Returns a literal representing the source code of the object e.g "function Object() { [native code] }" or "function Car(manufactuer, model, productionyear) { this.make = manufactuer; this.model = model; this.year = productionyear; }".
string toString()
Returns a string representing the object i.e. "[object Object]".
void unwatch(property)
Removes a previously set watchpoint.
								
object valueOf()
Returns the primitive value of the object e.g. "function Object() { [native code] }".
void watch(property, handlingFunction)
Calls the handlingFunction when the property is changed.
								

properties

constructor
The constructor method is the base method used to create an instance of the object.
hash
host
The host portion of the href, i.e. the domain. For example, in the URL "http://www.cathmhaol.com/license/index.asp?domain=cathmhaol.com&filename=license.asp", the host is "cathmhaol.com".
hostname
The host portion of the href, i.e. the domain. For example, in the URL "http://www.cathmhaol.com/license/index.asp?domain=cathmhaol.com&filename=license.asp", the hostname is "cathmhaol.com".
href
The URL of the link object.
pathname
The path portion of the href, i.e. the portion of the URL between the host and the query string. For example, in the URL "http://www.cathmhaol.com/license/index.asp?domain=cathmhaol.com&filename=license.asp", the pathname is "license/index.asp".
port
The port portion of the href. For example, in the URL "http://www.cathmhaol.com:80/license/index.asp?domain=cathmhaol.com&filename=license.asp", the pathname is "80".
protocol
The protocol portion of the href, e.g. ftp, http, or mailto.
prototype
Exposes the prototype for the method or property of the object.
search
text

events

onclick
ondblclick
onkeydown
onkeypress
onkeyup
onload
onmousedown
onmouseout
onmouseover
onmouseup