• var elem1 = xml.createElement("elem1"); var elem2 = xml.createElement("elem2"); // Now lets insert these two Element nodes into // the DocumentFragment.
  • Chapter 6: Using the DOM in Different
  • // Note that this function responds to the




    Download 2,96 Mb.
    Pdf ko'rish
    bet123/131
    Sana14.05.2024
    Hajmi2,96 Mb.
    #232039
    1   ...   119   120   121   122   123   124   125   126   ...   131
    Bog'liq
    Ceponkus, Hoodbhoy - Applied XML - Toolkit for Programmers

    // Note that this function responds to the 
    onload
     event on the 
    // tag.
    function start() {
    // First create a DocumentFragment node.
    var myDocFrag = xml.createDocumentFragment();
    // Let's also create two elements.
    var elem1 = xml.createElement("elem1");
    var elem2 = xml.createElement("elem2");
    // Now let's insert these two Element nodes into 
    // the DocumentFragment.
    myDocFrag.insertBefore(elem1, null);
    myDocFrag.insertBefore(elem2, null);
    // Now that we have finished collecting nodes
    // let's insert them under the 
    rootElement
     Element.
    xml.documentElement.insertBefore(myDocFrag, null);
    // Now let's view the resulting XML document.
    alert(xml.xml);
    }



    ...




    Download 2,96 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    // Note that this function responds to the

    Download 2,96 Mb.
    Pdf ko'rish