Export (0) Print
Expand All
6 out of 17 rated this helpful - Rate this topic

expando property

Sets or retrieves a value indicating whether arbitrary variables can be created within the object.

Syntax

JavaScript

p = object.expando

Property values

Type: Boolean

true (true)

Default. Creation of arbitrary variables is allowed.

false (false)

Creation of arbitrary variables is not allowed.

Remarks

You can extend the properties on an object by creating arbitrary properties with values. You should be careful, however, because you can unintentionally set a property value when scripting in a case-sensitive language such as Microsoft JScript. For example, if the property value is borderColor and you type the value "bordercolor = 'blue'", you have, in fact, created another property on the style object called bordercolor with the value 'blue'. If you query the value of the property, the value "blue" is returned. However, the borders for the element do not turn blue.

Setting the expando property of the document object to VARIANT_FALSE precludes the functionality of all expandos within the document.

Microsoft Visual Basic Scripting Edition (VBScript) does not support expando properties on its native language objects, nor does it cause Windows Internet Explorer to create expando properties on its objects. Internet Explorer supports creation of expando properties on its objects, in any language, through setAttribute.

In Microsoft Internet Explorer 6, this property now applies to the attribute object.

Examples

The following example demonstrates that, by setting the expando property of the document object to VARIANT_FALSE, the document ignores the UNSELECTABLE expando on the span and allows you to select the text.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/expando.htm


<html>

<head>
<script type="text/javascript">
    //Set the expando property to false.
    document.expando = false;
</script>
</head>

<body>

<div>
    <span id="oSpan" unselectable="on">This text should be selectable.</span>
</div>

</body>

</html>

Using the previous example and setting the expando property of the document object to VARIANT_TRUE, the span will not allow you to select the text.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/expando_2.htm


<html>

<head>
<script type="text/javascript">
    //Set the expando property to true.
    document.expando = true;
</script>
</head>

<body>

<div>
    <span id="oSpan" unselectable="on">This text should not be selectable.</span>
</div>

</body>

</html>

See also

attribute
document

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.