Sets or retrieves the destination URL or anchor point.
dhtml语法
HTML | <ELEMENT HREF
= sURL... >
|
---|
Scripting | object.href [ = sURL ] |
---|
DHTML可能的值
sURL | String that
specifies or receives the URL or anchor point. |
The property is read/write.
The property has no default value.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see about dynamic properties.
remarks
href attributes on anchors can be used to jump to bookmarks or any object's identification attribute.
if href is present but is blank (in other words href="" or href=), executing the link could possibly display the directory containing the current page, or it could generate an error depending on other elements on the web page and the server environment.
when an anchor is specified, the link to that address is represented by the text between the opening and closing anchor tags.
for more information on standard internet protocols such as ftp, http, and mailto, see Predefined Protocols.
Note Microsoft® Internet Explorer 6燬ervice Pack 1 (SP1) no longer allows browsing a local machine from the Internet zone. For instance, if an Internet site contains a link to a local file, Internet Explorer 6燬P1 displays a blank page when a user clicks on the link. Previous versions of Internet Explorer followed the link to the local file.
DHTML代码范例
This example function returns the href property of the current page location.
function getHref()
{
return document.location.href;
}
是否符合公共标准
This property is defined in
HTML 3.2 and
is defined in
World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .
Applies To