You are here: irt.org | FAQ | JavaScript | Window | Q714 [ previous next ]
Try this:
<FORM NAME="radioForm"> Question 0? Yes <INPUT TYPE="RADIO" NAME="q0"> No <INPUT TYPE="RADIO" NAME="q0"><BR> Question 1? Yes <INPUT TYPE="RADIO" NAME="q1"> No <INPUT TYPE="RADIO" NAME="q1"><BR> Question 2? Yes <INPUT TYPE="RADIO" NAME="q2"> No <INPUT TYPE="RADIO" NAME="q2"><BR> <P> <INPUT TYPE="BUTTON" onClick="passAnswers()" VALUE="Finished"> </FORM> <SCRIPT LANGUAGE="JavaScript"><!-- function passAnswers() { var output = ''; for (var i=0;i<3;i++) { if (eval("document.radioForm.q" + i + "[0].checked") == true) output += 'Question ' + i + ' = yes'; if (eval("document.radioForm.q" + i + "[1].checked") == true) output += 'Question ' + i + ' = no'; } windowHandle = window.open('blank.htm'); windowHandle.document.open(); windowHandle.document.write(output); windowHandle.document.close(); } //--></SCRIPT>