home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mozil06.zip / bin / res / rdf / dom-test-7.xul < prev    next >
Extensible Markup Language  |  2001-02-14  |  2KB  |  48 lines

  1. <?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil c-basic-offset: 2 -*- -->
  2. <!--
  3.  
  4. The test exercises creation and removal of HTML elements.
  5.  
  6. -->
  7.  
  8. <?xml-stylesheet type="text/css" href="resource:/res/samples/xul.css"?>
  9.  
  10. <window xmlns:html="http://www.w3.org/1999/xhtml"
  11.         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  12.  
  13.   <html:script>
  14.   var open = false;
  15.  
  16.   function toggleOpenClose()
  17.   {
  18.     var container = document.getElementById('container');
  19.  
  20.     if (open) {
  21.       // close
  22.       dump("\n\n\n\nCLOSING\n\n");
  23.       container.removeChild(container.firstChild);
  24.     }
  25.     else {
  26.       // open
  27.       dump("\n\n\n\nOPENING\n\n");
  28.       var frame = document.createElement('box');
  29.       frame.setAttribute('align', 'vertical');
  30.       frame.setAttribute('style', 'width: 50px; height: 50px; background: red;');
  31.       container.insertBefore(frame, container.firstChild);
  32.     }
  33.  
  34.     open = !open;
  35.   }
  36.   </html:script>
  37.  
  38.  
  39.   <html:button onclick="toggleOpenClose();" flex="100%">Add/Remove Red Element At 0</html:button>
  40.   The order should stay 'blue, green, yellow'.
  41.  
  42.   <box id="container" align="horizontal" style="height: 100%; width: 100%;" flex="100%">
  43.     <box align="vertical" style="width: 50px; height: 50px; background: blue;" />
  44.     <box align="vertical" style="width: 50px; height: 50px; background: green;" />
  45.     <box align="vertical" style="width: 50px; height: 50px; background: yellow;" />
  46.   </box>
  47. </window>
  48.