Share via


A XHTML Element

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

The A element designates the start or destination of a hypertext link. This is an inline element and requires a closing tag. It is also referred to as the scripting object link.

Using this Element

There are some common properties and collections that apply to all the elements of the document object model, see Common Properties, Methods and Collections for the HTML Elements in Internet Explorer Mobile.

This element can be used within a web page with attributes.

This element can be used within scripts where it will have properties, events and methods.

Attributes

The following table shows items that Internet Explorer Mobile supports.

Attribute Value Description

ACCESSKEY

0...9, #, *

Gives access or focus to an active HTML element by using a keypad number.

> [!NOTE] > Supported only on Pocket PC for Windows Mobile 2003 and later.

CLASS

 

Associates the element with a cascading style sheet (CSS) style.

> [!NOTE] > Supported only for devices running Windows Mobile 2003 software or later.

HREF

URL

A string that specifies a destination URL or anchor point — for example, #bookmark, mailto:, or tel.

 

#

Links to a named anchor point in the document.

 

mailto:

Starts or uses the default mail client to send e-mail to the specified.

 

tel:

 

 

wtai:

 

ID

 

Uniquely identifies the element within a document.

> [!NOTE] > Supported only for devices running Windows Mobile 2003 software or later.

MEMORYNAME

String

If the HREF value is either a mailto: or tel:, then this will be assumed to be a name. The name format can have a hyphen to separate two parts of the name. If present, this name will be stored in the contacts list when this link is selected.

> [!NOTE] > Not all Windows Mobile devices will support this feature.

NAME

String

Specifies a name or bookmark for the current section of the document.

ONCLICK

 

Event that occurs when the user chooses the A element.

> [!NOTE] > For PocketPCs, supported only for devices running Pocket PC 2002 software or later.

STYLE

 

Provides the definition of the CSS styles used for this element.

> [!NOTE] > Supported only for devices running Windows Mobile 2003 software or later.

TABINDEX

Number

Sets the order in which elements are tabbed to.

> [!NOTE] > Supported only for devices running Windows Mobile 2003 software or later.

TARGET

 

 

TARGET

_blank

Causes Internet Explorer Mobile to navigate the topmost document to the HREF.

 

_parent

Causes the immediate parent of the frame to navigate to the HREF.

 

_self

Causes the current window or frame to navigate to the HREF. This is the same as not using the TARGET attribute.

 

_top

Causes Internet Explorer Mobile to navigate the topmost document to the HREF.

> [!NOTE] > Not supported on Windows Mobile Standard.

Scripting Properties

The following table shows items that Internet Explorer Mobile supports.

Property Type Access Comments

accessKey

string

Read/Write

Sets or retrieves the number associated with the accesskey attribute.

> [!NOTE] > Supported only for devices running Smartphone 2002 and Pocket PC 2002 software or later.

hash

string

Read/Write

Sets or retrieves the part of the HREF after the "#" mark character.

host

string

Read/Write

Sets or retrieves the hostname of the location of page.

hostname

string

Read/Write

Sets or retrieves the host name part of the location of the page. This does not include the port number.

href

string

Read/Write

Sets or retrieves the destination URL or anchor point.

name

string

Read/Write

Sets or retrieves the anchor bookmark name.

> [!NOTE] > Supported only for devices running Smartphone 2002 and Pocket PC 2002 software or later.

pathname

string

Read/Write

Sets or retrieves the file name or path of the location of the page. This always begins with a "/" character.

port

string

Read/Write

Sets or retrieves the port number associated with the URL. If the port number is not included on the URL, it will not be added. The default values are 21 for File Transfer Protocol (FTP), 70 for the Gopher protocol, 80 for HTTP, and 443 for HTTP Secure (HTTPS).

protocol

string

Read/Write

Sets or retrieves the protocol portion of the URL. It returns the initial substring of a URL including the colon.

search

string

Read/Write

Sets or retrieves the search (query) string portion of the HREF. This includes the leading question mark.

target

string

Read/Write

Sets or retrieves the target of the HREF.

Scripting Events

The following table shows items that Internet Explorer Mobile supports.

Event Comment

onblur

 

onclick

This event fires when the user taps on the <A> element.

> [!NOTE] > When using the stylus on Windows Mobile touch screen devices, this event occurs only when the user presses the stylus down on the <A> and then releases the selection without moving more than 5 pixels away from the point where the stylus was pressed down. You can specify a special handler for this event.

onfocus

 

Scripting Methods

The following table shows items that Internet Explorer Mobile supports.

Method Comments

blur

Syntax:

link.blur()

click

Syntax:

link.click()

focus

Syntax:

link.focus()

  • Gives selection focus to the link.
> [!NOTE] > Supported only for devices running Smartphone 2002 and Pocket PC 2002 software or later.

getAttribute

Syntax:

vAttrValue=link.getAttribute(sAttrName[,iFlags])

  • Returns the value of the specified attribute. If the attribute is not present then a NULL is returned.
    • sAttrName is a String containing the name of the attribute.
    • iFlags is an integer that specifies one or more of the following:
      0 (Default) Performs a property search that is not case-sensitive, and returns an interpolated value if the property is found.
      1 Performs a case-sensitive property search. To find a match, the uppercase and lowercase letters in sAttrName must exactly match those in the attribute name.
      2 Returns the value exactly as it was set in script or in the source document.

Requirements

Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

See Also

Concepts

Internet Explorer Mobile HTML Elements