home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mozil06.zip / bin / res / rdf / dom-test-4.xul < prev    next >
Text File  |  2001-02-14  |  1KB  |  59 lines

  1. <!--
  2.  
  3. This test exercises some of the Level 1 Core DOM APIs.
  4.  
  5. -->
  6.  
  7.  
  8. <?xml-stylesheet type="text/css" href="dom-test-4.css"?>
  9.  
  10. <foo:foo xmlns:foo="http://foo.bar.com/xml#" xmlns:html="http://www.w3.org/1999/xhtml"
  11.          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  12.  
  13. <html:script>
  14. function swap()
  15. {
  16.   var barElements = document.getElementsByTagName("bar");
  17.   var child1 = barElements[1];
  18.   dump("child1 = " + child1 + "\n");
  19.  
  20.   var child2 = barElements[2];
  21.   dump("child2 = " + child2 + "\n");
  22.  
  23.   var parent = child1.parentNode;
  24.   dump("parent = " + parent + "\n");
  25.  
  26.   parent.insertBefore(child2, child1);
  27. }
  28.  
  29.  
  30. function toggleColor()
  31. {
  32.   var barElements = document.getElementsByTagName("bar");
  33.   var child1 = barElements[1];
  34.  
  35.   if (child1.getAttribute("enabled")) {
  36.     child1.removeAttribute("enabled");
  37.   }
  38.   else {
  39.     child1.setAttribute("enabled", "true");
  40.   }
  41. }
  42. </html:script>
  43.  
  44.   <html:input name="b1"
  45.               type="button"
  46.               value="Swap"
  47.               onclick="swap();"/>
  48.  
  49.   <html:input name="b2"
  50.               type="button"
  51.               value="Toggle #2's Color"
  52.               onclick="toggleColor();"/>
  53.  
  54.   <foo:bar>This</foo:bar>
  55.   <foo:bar id="one">is</foo:bar>
  56.   <foo:bar id="two">really</foo:bar>
  57.   <foo:bar>great</foo:bar>
  58. </foo:foo>
  59.