Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-08-2012, 11:19 PM   PM User | #1
Ngene
New to the CF scene

 
Join Date: Nov 2012
Location: Nigeria
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Ngene is an unknown quantity at this point
Thumbs up I need help with this Javascript function please

Please help me out, i need help with this code.I attached this function to the on-click event of a button I need it to automatically write a new question to the page after checking the answer of the previous question, without reloading the page.I need it to loop continuously to the end of the questions array. Please help me out.

[CODE]
function buttonCheckQ_onclick()
{
var answer = 0;
while (document.QuestionForm.radQuestionChoice[answer].checked != true)
{
answer++;
}
answer = String.fromCharCode(65 + answer);
if (answerCorrect (questionNumber, answer) == true)
{
alert("Right answer");
}
else
{
alert("Wrong answer. " + answers[questionNumber] + " is the right answer.");
}
for (var qCounter = 0;qCounter < questions.length; qCounter++)
{
document.getElementById('questionDisplay').innerHTML = "";
QuestionFormDisplay()
window.location.reload()
}
}
[CODE]
Ngene is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:05 PM.


Advertisement
Log in to turn off these ads.