'expando' Example : document « Javascript Objects « JavaScript DHTML






'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>

    
      
        
  








Related examples in the same category

1.Active Element
2.Document 'URLUnencoded' Example
3.'URL' Example
4.Create a Comment
5.'write()' Example
6.'writeln()' Example
7.Execute Command
8.Document parentWindow
9.Document referrer
10.Document compatMode
11.Document design Mode
12.Document doctype
13.Document Domain
14.Document title Example
15.Document Link color
16.Use document.links collection
17.Print page out
18.Expose the prperties of Objects