Explaination of Javascript code

K

kim

Please explain the following

<SCRIPT>
var aRadio1Answers=new Array("Correct. George Washington was the first
President of the United States of America.","Abraham Lincoln came a
tad bit later","Christopher Columbus was an explorer, not a United
States President.","Robert Plant was a singer with Led Zeppelin, not a
United States President.");
function fnGetAnswer(){
for(var i=0;i<Form1.radio1.length;i++){
if(Form1.radio1(i).checked){
alert(aRadio1Answers);


What is var i = 0;<Form1.radio1.length;i++)

Now remember I have no programming experince. I understand the if and
alert.
Where did (i) come from and how do you know which button has been
checked

<TABLE>
<TR><TD><LABEL FOR=oRadio1>George Washington</LABEL></td><td><INPUT
TYPE=radio NAME="radio1" ID="oRadio1"></TD></TR>
<TR><TD><LABEL FOR=oRadio2>Abraham Lincoln</LABEL></TD><TD><INPUT
TYPE=radio NAME="radio1" ID="oRadio2"></TD></TR>
<TR><TD><LABEL FOR=oRadio3>Christopher Columbus</LABEL></TD><TD><INPUT
TYPE=radio NAME="radio1" ID="oRadio3"></TD></TR>
<TR><TD><LABEL FOR=oRadio4>Robert Plant</LABEL></TD><TD><INPUT
TYPE=radio NAME="radio1" ID="oRadio4"></TD></TR>
</TABLE>
<P>
<INPUT TYPE=button VALUE="Check Answer" onclick="fnGetAnswer()">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top