vincentms
04-17-2003, 05:44 AM
Hello All,
I have made a lot of progress with JavaScript in the last week. But, I have hit a wall now!!!
Please look at my script and tell me why I am getting this little error. I want to press the next button repeatedly and not get errors. Must I do some sort of clear/reset each time??? At some point I will add some logic (i.e., if x = 20 THEN (Press FINISH Button) execute an allFinished Function.
Thanks,
Vincent
Zürich, Switzerland
Go Raiders
<HTML>
<HEAD>
<SCRIPT>
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()));
getNext();
return r;
}
function getNext() {
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"> Iraq<br></p>') ;
document.write('<INPUT type="button" value=" Next" onClick=" getRandom()"> ');
return r;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="QForm">
<INPUT type="button" value="Start" onClick=" getRandom()">
</FORM>
</BODY>
</HTML>
I have made a lot of progress with JavaScript in the last week. But, I have hit a wall now!!!
Please look at my script and tell me why I am getting this little error. I want to press the next button repeatedly and not get errors. Must I do some sort of clear/reset each time??? At some point I will add some logic (i.e., if x = 20 THEN (Press FINISH Button) execute an allFinished Function.
Thanks,
Vincent
Zürich, Switzerland
Go Raiders
<HTML>
<HEAD>
<SCRIPT>
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()));
getNext();
return r;
}
function getNext() {
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"> Iraq<br></p>') ;
document.write('<INPUT type="button" value=" Next" onClick=" getRandom()"> ');
return r;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="QForm">
<INPUT type="button" value="Start" onClick=" getRandom()">
</FORM>
</BODY>
</HTML>