Is technical, or software the right place for code-y questions?
Anyway, why isn't my code working? I'm expecting that on clicking a radio button, then the value of it is passed to my variables, and then displayed.
I'm obviously doing something wrong though, as the textboxes displaying my variables simply say 'undefined'
HTML code:
<HTML>
<HEAD>
<script type="text/javascript">
//THIS IS THE FUNCTION FOR MANIPULATING CHECKBOXES AND PRICING
function calcUS(){
// Gathers field information
var f1 = (document.listofoptions.elements['Grp1'].value);
var jb = (document.listofoptions.elements['Grp1'].value);
document.displayForm.elements['JBTest'].value = jb;
document.displayForm.elements['F1Test'].value = f1;
}
//END OF CHECKBOX FUNCTION
</script>
</HEAD>
<BODY>
<form name="listofoptions">
<TABLE>
<TR>
<td width= 50%>
Check1
</td>
<td width= 10%>
<input type="radio" name="Grp1" value="Check1" onclick="calcUS()">
</td>
</tr>
<tr>
<td width= 50%>
Check2
</td>
<td width= 10%>
<input type="radio" name="Grp1" value="Check2" onclick="calcUS()">
</td>
</tr>
</TABLE>
</form>
<form name="displayForm">
<TABLE>
<TR>
<td width= 50%>
<input type="textbox" readonly style="background: #DDD; color: #000;" name="JBTest" value="" style="width:80px">
</td>
</tr>
<TR>
<td width= 50%>
<input type="textbox" readonly style="background: #DDD; color: #000;" name="F1Test" value="" style="width:80px">
</td>
</tr>
</TABLE>
</form>
</BODY>
</HTML>
EDITED: 9 Feb 2011 14:51 by RADIO