Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.