www.webdeveloper.com
Results 1 to 2 of 2

Thread: XML into HTML? Please help.

  1. #1
    Join Date
    May 2010
    Posts
    35

    XML into HTML? Please help.

    I have a report launching script that loads the filters from AJAX for a specific report when the report is selected from a drop down list.

    My goal is to get the html from within the <html> node and insert it to a pre-existing DIV. I'm having trouble doing this. I tried to use nodeCopy() and even created my own function copyChildNodes. The only thing that is copying is the text 'Dateate Range: to ' which is displayed in the div without the input fields.

    Please help, thanks.

    Code:
    function copyChildNodes(objRefNode, objParentNode){
      nodeCount = objRefNode.childNodes.length;
      for (var n=0; n<nodeCount; n++){
        copiedNode = objParentNode.appendChild(objRefNode.childNodes[n]);
        if (objRefNode.childNodes[n].hasChildNodes){
          copyChildNodes(objRefNode.childNodes[n], copiedNode);
        }
      }
    }
    The XML Returned is:
    Code:
    <reportFilters>
        <html>
          <form name='reportFilters' method='post' target='_blank'>
            <input type='radio' name='date' value='single' checked='checked' />Date:
            <input type='text' id='datebox0'  name='date_0' value='' /><br/>
            <input type='radio' name='date' value='range'/>Date Range:
            <input type='text' id='datebox1' name='date_1' value=''/><span style='float:middle'> to </span>
            <input type='text' id='datebox2' name='date_2' value=''/><br/><br/>
            <input type='submit' id='btnSubmit' name='report' value='Create Report'/>
          </form>
        </html>
        <script type='text/javascript'>
          cal0 = new Calendar({ datebox0: 'm/d/Y' }, {direction: -1});
          cal1 = new Calendar({ datebox1: 'm/d/Y' }, {direction: -1});
          cal2 = new Calendar({ datebox2: 'm/d/Y' }, {direction: -1});
        </script>
      </reportFilters>

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    You may try using cloneNode() method:
    https://developer.mozilla.org/En/DOM/Node.cloneNode

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles