Click to return to the DHTML, HTML     
B Element | B Object     BASEFONT Element | BASEFO...     DHTML Objects    
Web Workshop  |  DHTML, HTML & CSS

BASE Element | BASE Object


Specifies an explicit URL used to resolve links and references to external sources such as images and style sheets.

HTML Syntax

<BASE
    HREF=url
    TARGET=window_name | _blank | _parent | _search | _self | _top 
>

Remarks

When used, the BASE element must appear within the HEAD of the document, before any elements that refer to an external source.

The BASE element does not require a closing tag.

This element is available in HTML as of Microsoft® Internet Explorer 3.0, and in script as of Internet Explorer 4.0.

Members

Example

This example sets the base URL of the document to a reference folder. Internet Explorer uses the BASE element to resolve the link to http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/href_2.asp.

<HEAD>
<BASE HREF="http://msdn.microsoft.com/workshop/author/dhtml/reference">
</HEAD>

<BODY>
Click <A HREF="properties/href_2.asp">here</A> to learn about the 
href property.
</BODY>

This example retrieves the base URL from the document if a valid BASE element is specified in the document. Otherwise, the function returns null.

<SCRIPT>
function GetBase()
{
    var oBaseColl = document.all.tags('BASE');
    return ( (oBaseColl && oBaseColl.length) ? oBaseColl[0].href : 
        null );
}
</SCRIPT>


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.