Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7805445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:13:48+00:00 2026-06-02T02:13:48+00:00

Hello I am newbie in HTML5 and j query. I have to parse data

  • 0

Hello I am newbie in HTML5 and j query. I have to parse data from XML that i have done successfully. After parsing data now I want to display it randomly using j query.Please suggest me how do I do this.

The code snippet is

 // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }else {
        // code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.open("GET","xml/multiquestions1.xml",false);
    xmlhttp.send();
    xmlDoc=xmlhttp.responseXML;     

    var x=xmlDoc.getElementsByTagName("question");
    $(document).ready(function (){
        for(var j=0;j<x.length;j++)
        {
            if(j==0)
            {
                $("#navigationlist").append('<li><a href="#" id="selected_link"  class="navg" onClick="display_nav('+j+',this);">'+(j+1)+'</a></li>');   
                display_nav(j,$("#selected_link"))
            }
            else
                $("#navigationlist").append('<li><a href="#" class="navg" onClick="display_nav('+j+',this);">'+(j+1)+'</a></li>');   
        }               
    });

function display()
    {
        // for fetch question
        Description=(x[i].getElementsByTagName("questionTxt")[0].childNodes[0].nodeValue);
        Answer =(x[j].getElementsByTagName("image")[0].childNodes[0].nodeValue);

        document.getElementById('options').style.backgroundImage = 'url('+Answer+')';

        // Assign the value
        document.getElementById("question").innerHTML= Description; 

    }   

function display_nav(j,obj)
    {
       i=j;
       $("#feedback").html(""); 
        $(".navg").each(function(){

           $(this).removeAttr("id");                         
        });

        $(obj).attr("id","selected_link");
        Description=(x[j].getElementsByTagName("questionTxt")[0].childNodes[0].nodeValue);
        Answer =(x[j].getElementsByTagName("image")[0].childNodes[0].nodeValue);
        answermin=(x[j].getElementsByTagName("answermin")[0].childNodes[0].nodeValue);
        answermax=(x[j].getElementsByTagName("answermax")[0].childNodes[0].nodeValue);

        $("#bob").attr("min",answermin);
        $("#bob").attr("max",answermax);
        $("#bob").attr("value",0);
        $("#out").html(0);
        $("#out").css({left:0});

        // Assign the value
        document.getElementById("question").innerHTML= Description;
        //document.getElementById("options").style.backgroundImage = url(Answer);
        document.getElementById('options').style.backgroundImage = 'url('+Answer+')';       
    }   

and xml is

<?xml version="1.0" encoding="utf-8"?>
<FlashCards>
  <question id="1">
    <questionTxt type="text"><![CDATA[Hello!]]></questionTxt>
<image visible="true"><![CDATA[img/smiley1.png]]></image>
    </question>  
 <question id="2">
    <questionTxt type="text"><![CDATA[Hi]]></questionTxt>
<image visible="true"><![CDATA[img/smiley2.png]]></image>

</question> 
</FlashCards>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:13:50+00:00Added an answer on June 2, 2026 at 2:13 am

    jQuery comes with its own parsing function jQuery.parseXML() -> parseXML

    Then you can do searches ontop of the parsed xml more easier.

    var xml = $.parseXML(xmlString),
        // find and count all questions
        questionCount = xml.find('question').length();
    // find a random question out of the pool
    xml.find('question#'+ Math.floor(Math.random() * (questionCount + 1))):
    

    I didn’t test it, but I hope you get the point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I am a newbie using F# and MySQL. I have a project that
I am a newbie in php, mysql. I have written a hello.php script, which
Introduction Hello. I am a newbie to PHP programming. I have know the basics
Hello friends a newbie question... The Issue is like this: I have a static
hello friends I am newbie to Yii.I have the date and time in mysql
hello i'm newbie in sql (postgresql) i have 2 tables as result of 2
I am a newbie android developer and so far have only got Hello World
Hello guys I newbie question :) - I am currently using PHP/Zend and now
hello all m a newbie to iphone development. I have 5 themes in my
Hello dearest community. I have trouble in the last two days, that I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.