topical media & game development

talk show tell print

professional-javascript-06-DocumentFragmentExample.htm / htm

          <title>insertBefore() Example</title>
          <script type="text/javascript">
              function addMessages() {
                  var arrText = ["first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth"];
                  var oFragment = document.createDocumentFragment();
                  for (var i=0; i < arrText.length; i++) {
                      var oP = document.createElement("p");
                      var oText = document.createTextNode(arrText[i]);
      <body onload="addMessages()">

(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.