ID Attribute

HTML (DHTML)

ID Attribute

Internet Development Index

Provides a unique identifier for an element. Read/write String.

Applies To

All VML elements.Shape-->

Tag Syntax

<v:elementname id="idname">

Script Syntax

elementname.id="idname"

expression=elementname.id

Remarks

Use ID to refer to a specific element. Once you have created a shape and given it an ID, you can use the ID name when you want to manipulate the element.

ID is required to use the ShapeType element.

When VML is generated by Microsoft Office, if an object model name is assigned to the shape, then ID is set to this name. If the object model name is not set, then the name is generated using the Spid (internal shape ID) plus a prefix (S for shape, M for master shape, T for shapetype).

VML Standard Attribute.

Example

To change the attributes of a shape, you must first give the shape an ID; for example, "myrect".

   <v:rect id=myrect fillcolor="red"
   style="position:relative;top:1;left:1;width:20;height:20">
   </v:rect>
Then you can use the following VBScript code to change the size and color of the shape.
   myrect.style.width = 80
   myrect.style.height = 80
   myrect.fillColor = "green"

ID Attribute Example. (Requires Microsoft Internet Explorer 5 or greater.)