|
Q714 How do I pass the values of radio buttons to a window created on the fly, rather than using the search function of an existing page?
irt.org | Knowledge Base | JavaScript | Window | Q714 [ previous next ]
Q714 How do I pass the values of radio buttons to a window created on the fly, rather than using the search function of an existing page?
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>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.