|
Hi Guys,
i have dynamic radio buttons i want to write script to select anyone of the radio button
a sample code as follows:
for(int i=0;i<=100;i++)
{%>
<input type="radio" value="10" name="cb<%=i++%>">Always
<input type="radio" value="9" name="cb<%=i++%>">Sometimes
<input type="radio" value="8" name="cb<%=i++%>">Rarely
<input type="radio" value="7" name="cb<%=i++%>">Never</td>
<%}%>
inthis i want to select atleast one radio button for each i value.
anysuggstions
Thanks in advance
Sanny
|
|
|
Hi,
Give a same name to the radio button instead of cb1,cb2.... and so on,it will automatically create an array and then u can check whether any of those is checked or not by usinfg thsi function
and passing obj as document.forms[0].cb
function checkRadio(obj)
{
for (var i=0;i<obj.length;i++)
{
if(obj.checked)
{
return true;
}
}
return false;
}
|
|
|
|
|
|
|
|