Url.target (Property)

The target attribute of an <A> tag if there is one.

Availability:

DOM level - 1
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape version - 2.0
Opera browser - 3.0
Property/method value type:String primitive
JavaScript syntax:-myUrl.target
-myUrl.target = aTarget
HTML syntax:<A TARGET="..."> <LINK TARGET="...">
Argument list:aTargetThe name of a new target window or frame

This property yields the value of the TARGET attribute in an <A>, <AREA> or <MAP> tag if there is one and an empty string if not.

You can assign a new value to this property so that the URL will be directed to a different window or frame.

Here are some example target values:

Netscape version 6.0 adds the _content target value for use within HTML that exists in the sidebar area. This ensures that the link is targeted at the main window and does not overwrite the sidebar.

Example code:

   <HTML>
   <HEAD>
   </HEAD>
   <BODY>
   <A NAME="EXAMPLE" HREF="http://www.mydomain.com:8080/folder/file.html#abcdef" TARGET="_top">Click here</A><BR>
   <SCRIPT>
   document.write(document.links[0].target);
   </SCRIPT>
   </BODY>
   </HTML>

See also:Anchor.hash, Anchor.target, BASE.target, Location.target, Map.target, URL, Url object, Url.hash, Url.host, Url.hostname, Url.href, Url.pathname, Url.port, Url.protocol, Url.search