Results 1 to 3 of 3

Thread: Display XML content in HTML page

Hybrid View

  1. #1
    Join Date
    Oct 2012

    Display XML content in HTML page


    I am newbie , I have application in which check-box tree is present. I want to pre-populate the check-box's if user before checked some of those check box.

    For that am getting XML format from my back-end perl script as shown below.like , in below XML only 0, 43,44,45,46 and 50 are coming so only those respective checkbox need to checked on page load.I want to display those checked check-box on page load .How can I do this .......?

    I tried with so many examples . but am not getting solution for my problem .Below is my XML format data which is am getting from perl script .

    <hashref memory_address="0x86f4880">
    <item key="0">1</item>
    <hashref memory_address="0x86f4880">
    <item key="43">1</item>
    <hashref memory_address="0x86f4880">
    <item key="44">1</item>
    <hashref memory_address="0x86f4880">
    <item key="45">1</item>
    <hashref memory_address="0x86f4880">
    <item key="46">1</item>
    <hashref memory_address="0x86f4880">
    <item key="50">1</item>

    Please Help

    Thank You

  2. #2
    Join Date
    Jul 2008
    urbana, il
    <input name='chk_0' type='checkbox' /><br />
    <input name='chk_1' type='checkbox' /><br />
    <input name='chk_2' type='checkbox' /><br />
    <input name='chk_3' type='checkbox' /><br />
    <input name='chk_4' type='checkbox' /><br />
    <input name='chk_5' type='checkbox' /><br />
    <input name='chk_6' type='checkbox' /><br />
    <input name='chk_7' type='checkbox' /><br />
    <input name='chk_8' type='checkbox' /><br />
    <input name='chk_9' type='checkbox' /><br />
    <input name='chk_10' type='checkbox' /><br />
    <input name='chk_11' type='checkbox' /><br />
    <input name='chk_12' type='checkbox' /><br />
    <input name='chk_13' type='checkbox' /><br />
    <input name='chk_14' type='checkbox' /><br />
    <input name='chk_15' type='checkbox' /><br />
    <input name='chk_16' type='checkbox' /><br />
    <input name='chk_17' type='checkbox' /><br />
    <input name='chk_18' type='checkbox' /><br />
    <input name='chk_19' type='checkbox' /><br />
    <input name='chk_20' type='checkbox' /><br />
    <input name='chk_21' type='checkbox' /><br />
    <input name='chk_22' type='checkbox' /><br />
    <input name='chk_23' type='checkbox' /><br />
    <input name='chk_24' type='checkbox' /><br />
    <input name='chk_25' type='checkbox' /><br />
    <input name='chk_26' type='checkbox' /><br />
    <input name='chk_27' type='checkbox' /><br />
    <input name='chk_28' type='checkbox' /><br />
    <input name='chk_29' type='checkbox' /><br />
    <input name='chk_30' type='checkbox' /><br />
    <input name='chk_31' type='checkbox' /><br />
    <input name='chk_32' type='checkbox' /><br />
    <input name='chk_33' type='checkbox' /><br />
    <input name='chk_34' type='checkbox' /><br />
    <input name='chk_35' type='checkbox' /><br />
    <input name='chk_36' type='checkbox' /><br />
    <input name='chk_37' type='checkbox' /><br />
    <input name='chk_38' type='checkbox' /><br />
    <input name='chk_39' type='checkbox' /><br />
    <input name='chk_40' type='checkbox' /><br />
    <input name='chk_41' type='checkbox' /><br />
    <input name='chk_42' type='checkbox' /><br />
    <input name='chk_43' type='checkbox' /><br />
    <input name='chk_44' type='checkbox' /><br />
    <input name='chk_45' type='checkbox' /><br />
    <input name='chk_46' type='checkbox' /><br />
    <input name='chk_47' type='checkbox' /><br />
    <input name='chk_48' type='checkbox' /><br />
    <input name='chk_49' type='checkbox' /><br />
    <input name='chk_50' type='checkbox' /><br />
    <input name='chk_51' type='checkbox' /><br />
    <input name='chk_52' type='checkbox' /><br />
    <input name='chk_53' type='checkbox' /><br />
    <input name='chk_54' type='checkbox' /><br />
    <input name='chk_55' type='checkbox' /><br />
    <input name='chk_56' type='checkbox' /><br />
    <input name='chk_57' type='checkbox' /><br />
    <input name='chk_58' type='checkbox' /><br />
    <input name='chk_59' type='checkbox' /><br />
    <input name='chk_60' type='checkbox' /><br />
    <input name='chk_61' type='checkbox' /><br />
    <input name='chk_62' type='checkbox' /><br />
    <input name='chk_63' type='checkbox' /><br />
    <input name='chk_64' type='checkbox' /><br />
    <input name='chk_65' type='checkbox' /><br />
    <input name='chk_66' type='checkbox' /><br />
    <input name='chk_67' type='checkbox' /><br />
    <input name='chk_68' type='checkbox' /><br />
    <input name='chk_69' type='checkbox' /><br />
    <input name='chk_70' type='checkbox' /><br />
    <input name='chk_71' type='checkbox' /><br />
    <input name='chk_72' type='checkbox' /><br />
    <input name='chk_73' type='checkbox' /><br />
    <input name='chk_74' type='checkbox' /><br />
    <input name='chk_75' type='checkbox' />
    var div=document.createElement("div");
    div.innerHTML= "<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"0\">1</item> \n</hashref> \n</perldata> \n<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"43\">1</item> \n</hashref> \n</perldata> \n<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"44\">1</item> \n</hashref> \n</perldata> \n<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"45\">1</item> \n</hashref> \n</perldata> \n<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"46\">1</item> \n</hashref> \n</perldata> \n<perldata> \n<hashref memory_address=\"0x86f4880\"> \n<item key=\"50\">1</item> \n</hashref> \n</perldata> \n";
     .map(function(elm){  return elm.getAttribute("key");  })
     .forEach(function(num){  document.forms[0].elements["chk_"+num].checked=true; });
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com

  3. #3
    Join Date
    Oct 2012

    Display XML content in HTML page

    HI thank you so much for your response . Exactly what am looking for

    But How can I trigger perl script from server side so that I can get that XML then pass it to HTML.Please Help for this, I spent lot of time for triggering this perl script from JS, but i didn't get any result.

    Thank You

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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