Link

Team-Fly    

 
Webmaster in a Nutshell, 3rd Edition
By Robert Eckstein, Stephen Spainhour
Table of Contents
Chapter 11.  JavaScript


Link Client-Side JavaScript 1.0

An <a> or <area> link Inherits From: Element
  document  .links[  i  ] 

Properties

Many of the properties of a Link object represent portions of its URL. For each such property below, the example given is a portion of the following (fictitious) URL:

 http://www.oreilly.com:1234/catalog/search.html ?q=JavaScript&m=10#results 
hash

A read/write string property that specifies the anchor portion of the Link's URL, including the leading hash (#) mark. For example: "#result".

host

A read/write string property that specifies the hostname and port portions of a Link's URL. For example: "www.oreilly.com:1234".

hostname

A read/write string property that specifies the hostname portion of a Link's URL. For example: "www.oreilly.com".

href

A read/write string property that specifies the complete text of the Link's URL.

pathname

A read/write string property that specifies the pathname portion of a Link's URL. For example: "/catalog/search.html".

port

A read/write string (not a number) property that specifies the port portion of a Link's URL. For example: "1234".

protocol

A read/write string property that specifies the protocol portion of a Link's URL, including the trailing colon . For example: "http:".

search

A read/write string property that specifies the query portion of a Link's URL, including the leading question mark. For example: "?q=JavaScript&m=10".

target

A read/write string property that specifies the name of a Window object (i.e., a frame or a top-level browser window) in which the linked document should be displayed. This property is the standard target HTML attribute. The special names "_blank", "_top", "_parent", and "_self" are allowed.

Event Handlers

onclick

Invoked when the user clicks on the link. In JavaScript 1.1, this event handler may prevent the link from being followed by returning false.

onmouseout

Invoked when the user moves the mouse off the link. JS 1.1.

onmouseover

Invoked when the user moves the mouse over the link. The status property of the current window may be set here. Return true to tell the browser not to display the URL of the link in the status line.

See Also

Anchor, Location


Team-Fly    
Top


Webmaster in a Nutshell
Webmaster in a Nutshell, Third Edition
ISBN: 0596003579
EAN: 2147483647
Year: 2002
Pages: 412

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net