Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Radio button - Element events

Status
Not open for further replies.

clear88

Programmer
Nov 29, 2001
24
CN
Hi there,

i am going to use radio element events to check all radio state in a page.

If type=radio then check state...(must select a Radio button )

can anybody help me ?
=====================code==================
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;&quot;>
Redio_1
<input type=&quot;radio&quot; name=&quot;radiobutton_1&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_1&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_1&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_1&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_1&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_1&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_1&quot; value=&quot;radiobutton&quot;>
<br>
Radio_2
<input type=&quot;radio&quot; name=&quot;radiobutton_2&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_2&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_2&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_2&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_2&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_2&quot; value=&quot;radiobutton&quot;>
<input type=&quot;radio&quot; name=&quot;radiobutton_2&quot; value=&quot;radiobutton&quot;>
</form>
<p>?/p>
</body>
</html>
===================end of code==================
 
mess = &quot;&quot;
for (x=1; x<=2; x++){
groupArray = eval(&quot;document.form1.radiobutton_&quot; + x)
foundChecked = false
for (y=0; y<groupArray.length; y++){
if (groupArray[y].checked){
foundChecked = true
break;
}
}
if (!foundChecked){
mess += &quot;\n-Group number &quot; + x
}
}

if (mess != &quot;&quot;){
alert(&quot;Please complete the following:&quot; + mess)
return false;
}
return true; Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top