PDA

View Full Version : Transfering the radio selected to a new page


b4me
09-04-2002, 05:01 PM
Alright here is my problem, I have some radio options and when i use the go.document.write(docuement.form.radioname.value)

Each one I put shows up on the new page, I am trying to get the one that is just selected to show up on the new page....

Can ne1 help me??? I am really lost....... thanks

requestcode
09-04-2002, 07:07 PM
You have to specify the index of the one that was checked. Here is an example that might help:
<html>
<head>
<title>Form Array Test</title>
<SCRIPT LANGUAGE="JavaScript">
function test(obj)
{
len=obj.a.length
for(i=0;i<len;i++)
{
if(obj.a[i].checked)
{alert(obj.a[i].value)}
}
}
</SCRIPT>
</head>
<body>
<CENTER>
<FORM NAME="myform">
<INPUT TYPE="radio" NAME="a" SIZE="10" VALUE="First One">First
<BR>
<INPUT TYPE="radio" NAME="a" SIZE="10" VALUE="Second One">Second
<BR>
<INPUT TYPE="radio" NAME="a" SIZE="10" VALUE="Third One">Third
<BR>
<INPUT TYPE="radio" NAME="a" SIZE="10" VALUE="Fourth One">Fourth
<BR>
<INPUT TYPE="button" VALUE="Click Me" onClick="test(this.form)">
</FORM>
</CENTER>
</body>
</html>

b4me
09-04-2002, 08:56 PM
thanks for your help