Expando Properties/Attributes

Internet Explorer 4.0 now supports what Microsoft have named 'expando' properties. Basically, this means that any attribute used in a known element can be manipulated through scripting. Also, within a script function, properties of referenced elements can be created, even if the attribute for the new property was never set. This is even taken a stage further, in that unknown elements can be used within a HTML document, setting attribute/property values which can be utilised in a script.

A good example of this has been used within the stand-alone HTMLib (available from http://www.htmlib.com. In each title (the non-scrolling region above the topic), the links that open the scripting and syntax windows use extra attributes of XSIZE and YSIZE, which are used to specify the size of the window that is opened to view the syntax, or scripting topic. For example:

<A HREF="expandos.htm" ID="SyntaxLink" ... XSIZE="375" YSIZE="390">Expando Syntax</A>

Within the HTMLib front-end, these properties are picked up when the link is activated and used to size the new window created. Within a HTML document:


would return the value given in the XSIZE attribute, if VBScript was the scripting language for the element. JScript (Javascript) is case-sensitive, so the reference would have to be:


otherwise, a new expando property of the referenced element would be created, with the lowercase name (which could cause hard-to-find scripting bugs).

Note that for expando properties to be activated within a document, the document.expando property must be set to true. This is the default value.

As you can see, this brings almost unlimited attribute access through scripting, as now you're free to set up/manipulate any attribute/property value. Any unknown attributes set in an element are accessible as a property of the element.