|
thnx for everyone , i need to make it using a function
this is my code:
<script language="JavaScript">
<!--
function radio_button_checker()
{
var i=1;
for(i=1;1<9;i++) // i have 8 radio buttons
{
// set var radio_choice to false
var radio_choice = false;
// Loop from zero to the one minus the number of radio button selections
for (counter = 0; counter < radio_form.myradiobutton[i].length; counter++)
{
// If a radio button has been selected it will return true
// (If not it will return false)
if (radio_form.radmyradiobutton[i][counter].checked)
radio_choice = true;
}
if (!radio_choice)
{
// If there were no selections made display an alert box
alert("Please select a letter.")
return (false);
}
return (true);
}
}
</script>
the red scirpt is working correctly
but when i made the for loop to start from myradiobutton1 to myradiobutton8
it did not work correctly
|