baseNN 6 IE 4 DOM 1  

  

A base object instructs the browser about the URL path to the current document. This path is then used as the basis for all relative URLs that are used to specify various src and href attributes throughout the document.

 
HTML Equivalent
 
<base>
 
Object Model Reference
 
[window.]document.getElementById("elementID")
 
Object-Specific Properties
 
hreftarget
 
Object-Specific Methods

None.

 
Object-Specific Event Handler Properties

None.

hrefNN 6 IE 4 DOM 1  

Read/Write  

Provides the URL of a document whose server path is to be used as the base URL for all relative references in the document. This is typically the URL of the current document, but it can be set to another path if it makes sense to your document organization and directory structure.

 
Example
 
document.getElementById("myBase").href = "http://www.megacorp.com";
 
Value

String of complete or relative URL.

 
Default

Current document pathname.

targetNN 6 IE 4 DOM 1  

Read/Write  

Provides the name of the window or frame that is to receive content as the result of navigating to a link or any other action on the page that loads a new document. Such names are assigned to frames by the frame element's name attribute; for subwindows, the name is assigned via the second parameter of the window.open( ) method. If you need the services of a target attribute to open a linked page in a blank browser window and you also need the HTML to validate under strict HTML or XHTML DTDs, you can omit the target attribute in the code, but assign a value to the base element's target property by script after the page loads.

 
Example
 
document.getElementById("myBase").target = "_blank";
 
Value

String value of the window or frame name, or any of the following constants (as a string): _parent | _self | _top | _blank. The _parent value targets the frameset to which the current document belongs; the _self value targets the current window; the _top value targets the main browser window, thereby eliminating all frames; and the _blank value creates a new window of default size.

 
Default

_self