home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 January / 01_02.iso / software / netscape62win / browser.xpi / bin / res / samples / checkboxTest.xul < prev    next >
Extensible Markup Language  |  2001-07-09  |  3KB  |  97 lines

  1. <?xml version="1.0"?> 
  2. <?xml-stylesheet href="chrome://navigator/skin/navigator.css" type="text/css"?> 
  3. <?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks.css" type="text/css"?> 
  4.  
  5. <!DOCTYPE window> 
  6.  
  7. <window style="overflow: auto" xmlns:html="http://www.w3.org/1999/xhtml"
  8.         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" orient="vertical" 
  9.         onload=""> 
  10.  
  11. <html:h1>TriStateCheckbox Test 1</html:h1>
  12.  
  13.  
  14. <html:script>
  15.  
  16. function MakeOneTriState()
  17. {
  18.   var tsbox = document.getElementById("normal");
  19.   tsbox.setAttribute("moz-tristate", "1");
  20. }
  21. function MakeTwoNormal()
  22. {
  23.   var tsbox = document.getElementById("tristate");
  24.   tsbox.removeAttribute("moz-tristate");
  25. }
  26.  
  27. function setTwoToMixed()
  28. {
  29.   var tsbox = document.getElementById("tristate");
  30.   tsbox.setAttribute("moz-tristatevalue", "2");
  31. }
  32.  
  33. function dumpTwoValue()
  34. {
  35.   var tsbox = document.getElementById("tristate");
  36.   dump ( "value of button two is " + tsbox.getAttribute("moz-tristatevalue") + "\n" );
  37. }
  38. function dumpOneValue()
  39. {
  40.   var tsbox = document.getElementById("normal");
  41.   dump ( "value of button one is " + tsbox.getAttribute("moz-tristatevalue") + "\n" );
  42. }
  43.  
  44. function disableTwo()
  45. {
  46.   var tsbox = document.getElementById("tristate");
  47.   tsbox.disabled = true;
  48. }
  49. function enableTwo()
  50. {
  51.   var tsbox = document.getElementById("tristate");
  52.   tsbox.disabled = false;
  53. }
  54.  
  55. </html:script>
  56.  
  57. <html:h3>
  58. This is a tri-state checkbox test. The first checkbox should only act like a
  59. normal two-state checkbox. The last one should behave like a tri-state.
  60. </html:h3>
  61.  
  62. <html:div>
  63.   <html:hr/>
  64. </html:div>
  65.  
  66. <html:label>
  67. <html:input type="checkbox" id="normal"/>Button One (Normal)
  68. </html:label>
  69.  
  70. <html:label>
  71. <html:input type="checkbox" moz-tristate="1" id="tristate"/>Button Two (Tristate)
  72. </html:label>
  73.  
  74. <html:label>
  75. <html:input type="checkbox" style="moz-tristate: 1;" id="foop"/>Button Three (Tristate set by css)
  76. </html:label>
  77.  
  78. <html:button onclick="MakeOneTriState()">Change Mode On Button One</html:button>
  79. <html:button onclick="MakeTwoNormal()">Change Mode On Button Two</html:button>
  80.  
  81. <html:div>
  82.   <html:hr/>
  83. </html:div>
  84.  
  85. <html:button onclick="setTwoToMixed()">Set Two To Mixed</html:button>
  86. <html:button onclick="dumpOneValue()">Dump Value of Button One</html:button>
  87. <html:button onclick="dumpTwoValue()">Dump Value of Button Two</html:button>
  88.  
  89. <html:div>
  90.   <html:hr/>
  91. </html:div>
  92.  
  93. <html:button onclick="disableTwo()">Disable Button Two</html:button>
  94. <html:button onclick="enableTwo()">Enable Button Two</html:button>
  95.  
  96. </window>
  97.