XML to HTML

Out of context: Reply #6

  • Started
  • Last post
  • 15 Responses
  • fugged0

    Cool. Actually quite easy to do.

    get a reference to the parent object, where you want to insert the create object. So let's say you want to add a paragraph to a div with the id of "bob".

    var parentObj = document.getElementById("bob");
    var newParagraph = document.createElement("p");
    var paragraphText = "This is my text";
    newParagraph.appendChild(paragra...
    parentObj.appendChild(newParagra...

    That would insert a paragraph with the text of "This is my text" into the div "bob".

    That's a super simple and bad example, in fact I didn't even check the syntax :)

View thread