JavaScript Reference/Javascript Properties/expando

Материал из Web эксперт
Перейти к: навигация, поиск

"expando" Example

    
<html>
<body>
<p id="myElement">Sample text, try to select part of it</p>
<script language="JavaScript">
function function1() {
    myElement.setAttribute("unselectable", "off", 0);
    document.expando = true;
}
function function2() {
    myElement.setAttribute("unselectable", "on", 0);
    document.expando = true;
}
</script>
<button onclick="function2();">Unselectable</button>
<button onclick="function1();">Selectable</button>
</body>
</html>



"expando" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |attribute (IE6 only)            document                      |
+----------------+--------------------------------------------------------------+



"expando" Possible Values

Possible Values
true         (the default) 
false.



"expando" Syntax and Note

Note:
Read and write property. 
Can custom properties be added to object. 
    
Syntax:
    
objectName.expando = value
The following example illustrates how to create a custom counter property:
document.expando = true; // instruct the browser to "expand" the properties array
document.counter = 0; // introduce a new property