Mephist0222
Programmer
I thought this would take 5 min, but 2 hours later, I am looking for help.
I have an unknown amount of radio buttons, I need to have them selected via 2 functions.
One selects them going down (++) the other going up (--). None can be selected until an action is taken. The fist one is selected no matter if you are going up or down should be the first radio button.
From me testing this out:
//function radio() {
//var x = document.otherForm.other;
//for (index=0; index < x.length; index++) {
//if (!x[index].checked) {
//x[0].checked = true;
//var radioValue = document.frmRadio.choice[index].value;
//break;
//}
// else {
//var i = x[index].checked
//x[i++].checked = true;
//var radioValue = document.frmRadio.choice[index].value;
//break;
//}
//}
//}
function radio(){
var x = document.otherForm.other;
for (var i=0;i<x.length;i++) {
if(!x.checked){
x[0].checked = true;
break;
}
else{
x[x.checked++].checked = true;
}
}
}
</script>
</head>
<body>
<form name="otherForm" method="post" onsubmit="validate('quant'); return false">
<input type="radio" name="other"> Size <br>
<input type="radio" name="other"> Color<br>
<input type="radio" name="other"> Gender
</form>
<a href="javascript:radio();" return false;>rooriro</a>
I have an unknown amount of radio buttons, I need to have them selected via 2 functions.
One selects them going down (++) the other going up (--). None can be selected until an action is taken. The fist one is selected no matter if you are going up or down should be the first radio button.
From me testing this out:
//function radio() {
//var x = document.otherForm.other;
//for (index=0; index < x.length; index++) {
//if (!x[index].checked) {
//x[0].checked = true;
//var radioValue = document.frmRadio.choice[index].value;
//break;
//}
// else {
//var i = x[index].checked
//x[i++].checked = true;
//var radioValue = document.frmRadio.choice[index].value;
//break;
//}
//}
//}
function radio(){
var x = document.otherForm.other;
for (var i=0;i<x.length;i++) {
if(!x.checked){
x[0].checked = true;
break;
}
else{
x[x.checked++].checked = true;
}
}
}
</script>
</head>
<body>
<form name="otherForm" method="post" onsubmit="validate('quant'); return false">
<input type="radio" name="other"> Size <br>
<input type="radio" name="other"> Color<br>
<input type="radio" name="other"> Gender
</form>
<a href="javascript:radio();" return false;>rooriro</a>