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

  1. <?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil c-basic-offset: 2 -*- -->
  2. <!--
  3.  
  4. This test exercises creation of DOM elements from the XUL document.
  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. var count = 0;
  15.  
  16. function newElement()
  17. {
  18.   var elem = document.createElement('foo:bar');
  19.   var text = document.createTextNode('Node ' + ++count);
  20.   elem.appendChild(text);
  21.   document.lastChild.appendChild(elem);
  22. }
  23.  
  24. function deleteElement()
  25. {
  26.   if (document.lastChild.lastChild) {
  27.     document.lastChild.removeChild(document.lastChild.lastChild);
  28.   }
  29. }
  30.  
  31. </html:script>
  32.  
  33.   <html:input name="b1"
  34.               type="button"
  35.               value="New"
  36.               onclick="newElement();"/>
  37.  
  38.   <html:input name="n2"
  39.               type="button"
  40.               value="Delete"
  41.               onclick="deleteElement();"/>
  42.  
  43. </foo:foo>
  44.