vincentms
04-17-2003, 09:25 AM
Hi All,
I dont know why my little code is getting an error. Please take a look and advise.
When I press the nextQuestion button it gets and error. ????
Kind regards,
Vincent
<HTML>
<HEAD>
<SCRIPT>
var r = 0;
var S = 0;
var p = 1;
var tpq = 5;
function getRandom() {
s = Math.round((p - 0.5) + (((tpq + 0.49999) - (p- 0.5)) * Math.random()));
nextQuestion();
return (r);
}
function nextQuestion() {
document.write('<p><input type="radio" value="a" name="q10"> Senegal<br></p>') ;
document.write('<p><input type="radio" value="b" name="q10">' + " " + s + '</span></<br></p>') ;
document.write('<p><input type="radio" value="c" name="q10"> Nigeria<br></p>') ;
document.write('<p><input type="radio" value="d" name="q10"> Mozambique<br></p>') ;
document.write('<INPUT type="button" value="Next Question" onClick=" getRandom()"> ');
return (r);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="QForm">
<INPUT type="button" value="Start EXAM"
onClick=" getRandom()">
</FORM>
</BODY>
</HTML>
:confused:
I dont know why my little code is getting an error. Please take a look and advise.
When I press the nextQuestion button it gets and error. ????
Kind regards,
Vincent
<HTML>
<HEAD>
<SCRIPT>
var r = 0;
var S = 0;
var p = 1;
var tpq = 5;
function getRandom() {
s = Math.round((p - 0.5) + (((tpq + 0.49999) - (p- 0.5)) * Math.random()));
nextQuestion();
return (r);
}
function nextQuestion() {
document.write('<p><input type="radio" value="a" name="q10"> Senegal<br></p>') ;
document.write('<p><input type="radio" value="b" name="q10">' + " " + s + '</span></<br></p>') ;
document.write('<p><input type="radio" value="c" name="q10"> Nigeria<br></p>') ;
document.write('<p><input type="radio" value="d" name="q10"> Mozambique<br></p>') ;
document.write('<INPUT type="button" value="Next Question" onClick=" getRandom()"> ');
return (r);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="QForm">
<INPUT type="button" value="Start EXAM"
onClick=" getRandom()">
</FORM>
</BODY>
</HTML>
:confused: