ID Attribute (VML)

This topic describes VML, a feature that is deprecated as of Windows Internet Explorer 9. Webpages and applications that rely on VML should be migrated to SVG or other widely supported standards.

Note

As of December 2011, this topic has been archived. As a result, it is no longer actively maintained. For more information, see Archived Content. For information, recommendations, and guidance regarding the current version of Windows Internet Explorer, see Internet Explorer Developer Center.

 

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

Applies To

All VML elements.

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>
   myrect.style.width = 80
   myrect.style.height = 80
   myrect.fillColor = "green"

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