IHTMLAnchorElement

IHTMLAnchorElement


Anchor elements designate the start or destination of a hypertext link. The Anchor element requires the href or the name property to be specified.

Text and/or images can be within an anchor. To represent images that are anchors, a border in the visited or not visited color is displayed.

IHTMLAnchorElement Methods
blur   focus   get_accessKey  
get_hash   get_host   get_hostname  
get_href   get_Methods   get_mimeType  
get_name   get_nameProp   get_onblur  
get_onfocus   get_pathname   get_port  
get_protocol   get_protocolLong   get_rel  
get_rev   get_search   get_tabIndex  
get_target   get_urn   put_accessKey  
put_hash   put_host   put_hostname  
put_href   put_Methods   put_name  
put_onblur   put_onfocus   put_pathname  
put_port   put_protocol   put_rel  
put_rev   put_search   put_tabIndex  
put_target   put_urn  

IHTMLAnchorElement::blur

HRESULT blur(void);

Causes a control to lose the focus and executes the code specified for the onblur event.

IHTMLAnchorElement::focus

HRESULT focus(void);

Causes the anchor element to receive the focus and executes the code specified for the onfocus event.

IHTMLAnchorElement::get_accessKey

HRESULT get_accessKey(
    BSTR *p
);

Retrieves the accelerator key for the A object.

p
Address of a string variable that contains the accelerator key for the element.

IHTMLAnchorElement::get_hash

HRESULT get_hash(
    BSTR *p
);

Retrieves the string associated with the hash property of the A object.

p
Address of a string variable that receives the value.

IHTMLAnchorElement::get_host

HRESULT get_host(
    BSTR *p
);

Retrieves the host name and the optional port information of the location or URL.

p
Address of a string variable that receives the host name. If no host name is available, this parameter receives an empty string.

IHTMLAnchorElement::get_hostname

HRESULT get_hostname(
    BSTR *p
);

Retrieves the host-name portion of the location or URL.

p
Address of a string variable that receives the host name. If no host name is available, this parameter receives an empty string.

IHTMLAnchorElement::get_href

HRESULT get_href(
    BSTR *p
);

Retrieves the destination URL or anchor point.

p
Address of a string variable that receives the destination URL or anchor point.

This method retrieves the href property of the A object.

IHTMLAnchorElement::get_Methods

HRESULT get_Methods(
    BSTR *p
);

Retrieves a list of methods that the user can perform on an object.

p
Address of a string variable that receives a comma-separated list of HTTP methods supported by the object for public use.

The functions that the user can perform on an object are more accurately given by the HTTP protocol when it is used, but it might, for reasons similar to the title property, be useful to include the information in advance in the link. For example, the HTML user agent might choose a different rendering as a function of the methods allowed, and thus something that is searchable might get a different icon.

IHTMLAnchorElement::get_mimeType

HRESULT get_mimeType(
    BSTR *p
);

Retrieves the MIME type for the file.

p
Address of a string variable that receives the MIME type.

IHTMLAnchorElement::get_name

HRESULT get_name(
    BSTR *p
);

Retrieves the name of the control, bookmark, or application.

p
Address of a string variable that receives the name.

This method is related to the name property of the A object.

IHTMLAnchorElement::get_nameProp

HRESULT get_nameProp(
    BSTR *p
);

Retrieves the file name from the URL that the browser uses to locate the anchor.

p
Address of a string variable that receives the file name.

IHTMLAnchorElement::get_onblur

HRESULT get_onblur(
    VARIANT *p
);

Retrieves the inline script associated with the onblur event on the A object.

p
Address of a VARIANT structure that contains the script.

IHTMLAnchorElement::get_onfocus

HRESULT get_onfocus(
    VARIANT *p
);

Retrieves the inline script associated with the onfocus event on the A object.

p
Address of a VARIANT structure that contains the script.

IHTMLAnchorElement::get_pathname

HRESULT get_pathname(
    BSTR *p
);

Retrieves the file or object path from the URL for the current browser location.

p
Address of a string variable that receives the path.

IHTMLAnchorElement::get_port

HRESULT get_port(
    BSTR *p
);

Retrieves the port number from the URL.

p
Address of a string variable that receives the port number. If no port is specified, this parameter receives an empty string.

IHTMLAnchorElement::get_protocol

HRESULT get_protocol(
    BSTR *p
);

Retrieves the protocol portion of the URL that the browser uses to locate the item associated with the anchor. The protocol portion, which indicates the access method, includes the initial substring of the URL up to and including the first colon.

p
Address of a string variable that receives the protocol.

IHTMLAnchorElement::get_protocolLong

HRESULT get_protocolLong(
    BSTR *p
);

Retrieves the long name of the protocol that the browser uses to locate the item associated with the anchor (for example, "Hypertext Transfer Protocol").

p
Address of a string variable that receives the protocol name.

IHTMLAnchorElement::get_rel

HRESULT get_rel(
    BSTR *p
);

Retrieves the relationship(s) described by the hypertext link from the anchor to the target.

p
Address of a string variable that receives the relationship(s). This parameter receives a comma-separated list of relationship values.

Values and their semantics will be registered by the HTML registration authority. The default relationship, if no other is given, is void. The rel property is used only when the href property is present.

IHTMLAnchorElement::get_rev

HRESULT get_rev(
    BSTR *p
);

Same as the rel property, but the semantics of the link type are in the reverse direction. A link from A to B with REL="X" expresses the same relationship as a link from B to A with REV="X". An anchor can have both rel and rev properties.

p
Address of a string variable that receives the relationship(s). This parameter receives a comma-separated list of relationship values.

IHTMLAnchorElement::get_search

HRESULT get_search(
    BSTR *p
);

Retrieves the substring that follows the ? symbol in the HREF attribute of the anchor element. This is the query string or form data.

p
Address of a string variable that receives the query string or form data.

IHTMLAnchorElement::get_tabIndex

HRESULT get_tabIndex(
    short *p
);

Retrieves the tab index of the element.

p
Address of a short integer variable that receives the tab index of the element.

IHTMLAnchorElement::get_target

HRESULT get_target(
    BSTR *p
);

Retrieves the target window or frame.

p
Address of a string variable that contains the target window or frame. Can be one of the following values:
_blank Specifies to load the link into a new blank window. This window is not named.
_parent Specifies to load the link into the immediate parent of the document the link is in.
_self Specifies to load the link into the same window the link was clicked in.
_top Specifies to load the link into the full body of the window.

The default value for the target depends upon the URL and site. If the user does not leave the site, the default is _self, but if the user exits to a new site, the default is _top.

IHTMLAnchorElement::get_urn

HRESULT get_urn(
    BSTR *p
);

Retrieves a uniform resource name (URN) for a target document. The format of URNs is under discussion (1994) by various working groups of the Internet Engineering Task Force.

p
Address of a string variable that receives the uniform resource name.

IHTMLAnchorElement::put_accessKey

HRESULT put_accessKey(
    BSTR v
);

Sets an accelerator key for the element. Pressing CTRL+key selects this anchor element in the user's browser.

v
String value specifying the key.

IHTMLAnchorElement::put_hash

HRESULT put_hash(
    BSTR v
);

Sets the string following the # symbol in the HREF attribute of the anchor element.

v
String value specifying the hash portion of the URL.

This property is useful for moving to a bookmark within a document. Assigning an invalid value does not cause an error.

IHTMLAnchorElement::put_host

HRESULT put_host(
    BSTR v
);

Sets the host name and the optional port information of the location or URL.

v
String value specifying the host name and the optional port information.

IHTMLAnchorElement::put_hostname

HRESULT put_hostname(
    BSTR v
);

Sets the host-name portion of the location or URL.

v
String value specifying the host name.

IHTMLAnchorElement::put_href

HRESULT put_href(
    BSTR v
);

Sets the destination URL or anchor point.

v
String value specifying the destination URL or anchor point.

The HREF attribute on the anchor is a scriptable attribute. HREFs on anchors can jump to bookmarks or any element's id attribute.

IHTMLAnchorElement::put_Methods

HRESULT put_Methods(
    BSTR v
);

Sets information about the functions that the user can perform on an object.

v
String value specifying a comma-separated list of HTTP methods supported by the object for public use.

The functions that the user can perform on an object are more accurately given by the HTTP protocol when it is used, but it might, for reasons similar to the title property, be useful to include the information in advance in the link. For example, the HTML user agent might choose a different rendering as a function of the methods allowed, and thus something that is searchable might get a different icon.

IHTMLAnchorElement::put_name

HRESULT put_name(
    BSTR v
);

Sets the name of the anchor.

v
String value specifying the name.

This method is related to the name property of the A object.

IHTMLAnchorElement::put_onblur

HRESULT put_onblur(
    VARIANT v
);

Sets the inline script associated with the onblur event on the A element.

v
VARIANT structure that contains the script to be set.

IHTMLAnchorElement::put_onfocus

HRESULT put_onfocus(
    VARIANT v
);

Sets the inline script associated with the onfocus event on the A element.

v
VARIANT structure that contains the script to be set.

IHTMLAnchorElement::put_pathname

HRESULT put_pathname(
    BSTR v
);

Sets the file or object path of the URL.

v
String value specifying the path.

IHTMLAnchorElement::put_port

HRESULT put_port(
    BSTR v
);

Sets the port number in a URL.

v
String value specifying the port number.

IHTMLAnchorElement::put_protocol

HRESULT put_protocol(
    BSTR v
);

Sets the protocol portion of the URL; that is, the initial substring up to and including the first colon. The protocol indicates the URL's access method.

v
String value specifying the protocol.

IHTMLAnchorElement::put_rel

HRESULT put_rel(
    BSTR v
);

Specifies the relationship(s) described by the hypertext link from the anchor to the target.

v
String value specifying the relationship(s). This parameter is a comma-separated list of relationship values.

Values and their semantics will be registered by the HTML registration authority. The default relationship, if no other is given, is void. The rel property is used only when the href property is present.

IHTMLAnchorElement::put_rev

HRESULT put_rev(
    BSTR v
);

Same as the rel property, but the semantics of the link type are in the reverse direction. A link from A to B with REL="X" expresses the same relationship as a link from B to A with REV="X". An anchor can have both rel and rev properties.

v
String value specifying the relationship(s). This parameter is a comma-separated list of relationship values.

IHTMLAnchorElement::put_search

HRESULT put_search(
    BSTR v
);

Sets the substring that follows the ? symbol in the HREF attribute of the anchor element. This is the query string or form data.

v
String value specifying the query string or form data.

IHTMLAnchorElement::put_tabIndex

HRESULT put_tabIndex(
    short v
);

Sets the tab index of the element.

v
Short integer value that specifies the tab index to set.

IHTMLAnchorElement::put_target

HRESULT put_target(
    BSTR v
);

Sets the window or frame to target.

v
String specifying the target window or frame. Can be one of the following values:
_blank Specifies to load the link into a new blank window. This window is not named.
_parent Specifies to load the link into the immediate parent of the document the link is in.
_self Specifies to load the link into the same window the link was clicked in.
_top Specifies to load the link into the full body of the window.

If there is no frame or window that matches the specified target, a new window is opened for the link.

The default value for the target depends upon the URL and site. If the user does not leave the site, the default is _self, but if the user exits to a new site, the default is _top.

IHTMLAnchorElement::put_urn

HRESULT put_urn(
    BSTR v
);

Sets a uniform resource name (URN) for a target document. The format of URNs is under discussion (1994) by various working groups of the Internet Engineering Task Force.

v
String value specifying the uniform resource name.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.