View Single Post
 
Old October 14th, 2005, 10:51 AM
interrupt interrupt is offline
Friend of Wrox
 
Join Date: May 2004
Location: , , .
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This should do it:


<form name="radioForm">
<input type="radio" id="r1" value=1 DISABLED>Radio 1
<br>
<input type="radio" id="r2" value=2 DISABLED>Radio 2
<br>
<input type="radio" id="r3" value=3 DISABLED>Radio 3
<br>
<input type="radio" id="r4" value=4 DISABLED>Radio 4
<br>
<input type="radio" id="r5" value=5 DISABLED>Radio 5
<br>
<input type="radio" id="r6" value=6 DISABLED>Radio 6
<br>
<input type="radio" id="r7" value=7 DISABLED>Radio 7
<br>
<input type="radio" id="r8" value=8 DISABLED>Radio 8
<br>
<input type="radio" id="r9" value=9 DISABLED>Radio 9
<br>
<input type="radio" id="r10" value=10 DISABLED>Radio 10
<br>
<input type="radio" id="r11" value=11 DISABLED>Radio 11
<br>
<input type="radio" id="r12" value=12 DISABLED>Radio 12
<br>
<input type="radio" id="r13" value=13 DISABLED>Radio 13
<br>
<input type="radio" id="r14" value=14 DISABLED>Radio 14
<br>
<input type="radio" id="r15" value=15 DISABLED>Radio 15
<br>
<a href="javascript:enabledisable()">Enable / Disable</a>
</form>


<script language ="javascript">
function enabledisable(){


var numa = Math.ceil(Math.random()*15);


for (var i = 1; i<numa+1; i++){
document.getElementById("r" + i).disabled = false;
document.getElementById("r" + i).checked = true;
}

for(var j =numa+1; j<=15; j++){
document.getElementById("r" + j).disabled = true;
document.getElementById("r" + j).checked = false;
}


}
</script>

HTH!
Joe