Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

249
Views
question navigation background color not changing

I am beginner and trying to make a dynamic quiz using ajax, I want to change the color of question number navigation when the radio button is checked and when I click on the Next button, the Background color should be green.

Here is the code

 <script type="text/javascript">
    function load_previous(){
        if(questionno=="1"){
            load_questions(questionno);
        }else{
            questionno=eval(questionno)-1;
            load_questions(questionno);
        }
    }
    function load_next(){
        questionno=eval(questionno)+1;
            load_questions(questionno);

<!------------------change ------bgcolor-------question number navigation------------------>
                   if(document.getElementById('r1').checked) {
    document.getElementById("quest-number").style.backgroundColor = 'Green';
    document.getElementById("quest-number").style.color = 'white';
}else if(document.getElementById('gender_Female').checked) {
    document.getElementById("r1").style.backgroundColor = 'gray';
    document.getElementById("quest-number").style.color = 'black';
} 
    }
    
    </script>
    <!------------------------SAVE----ANSWER---------------------->
    <script>
    function radioclick(radiovalue, questionno){
        var xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        }
    };
    xmlhttp.open("GET", "ajax/save_answer_in_session.php?questionno="+ questionno + "&value1=" + radiovalue, true);
    xmlhttp.send(null); 
    }
    
    
    </script>![enter image description here](https://i.stack.imgur.com/94cnP.jpg)
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!