View Single Post
 
Old October 13th, 2005, 07:48 PM
kanoorani kanoorani is offline
Authorized User
 
Join Date: Aug 2005
Location: , , .
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Default dynamically enable/disable radio btns

hi again
below, i m pasting some html code ... in this html, i've created 15 radio btns, "r1" to "r15" ... and in the end ... there is a link to a function enabledisable()
when the function is called ... it generates a random number from 1 to 15 (i've did this too) ... now ... what i've 2 do iz that ... whatever the random number comes ... all the radio btns from "r1" till that random number should become ENABLED & CHECKED !!! got my point ???
i mean that if the number comes 7 ... then all the radio btns from "r1" to "r7" should become ENABLED + CHECKED !!!
every time when V click the link ... it should do the same
i hope u've got my point N u'll help me

<html>
<head>
<title>Enable / Disable</title>
</head>
<script language="JavaScript">
function enabledisable()
{
    num=Math.ceil(Math.random()*15);
    // WHAT TO DO AFTER THIS ???
}
</script>
<body>
<form name="radioForm">
<input type="radio" name="r1" value="r1" DISABLED>Radio 1
<br>
<input type="radio" name="r2" value="r2" DISABLED>Radio 2
<br>
<input type="radio" name="r3" value="r3" DISABLED>Radio 3
<br>
<input type="radio" name="r4" value="r4" DISABLED>Radio 4
<br>
<input type="radio" name="r5" value="r5" DISABLED>Radio 5
<br>
<input type="radio" name="r6" value="r6" DISABLED>Radio 6
<br>
<input type="radio" name="r7" value="r7" DISABLED>Radio 7
<br>
<input type="radio" name="r8" value="r8" DISABLED>Radio 8
<br>
<input type="radio" name="r9" value="r9" DISABLED>Radio 9
<br>
<input type="radio" name="r10" value="r10" DISABLED>Radio 10
<br>
<input type="radio" name="r11" value="r11" DISABLED>Radio 11
<br>
<input type="radio" name="r12" value="r12" DISABLED>Radio 12
<br>
<input type="radio" name="r13" value="r13" DISABLED>Radio 13
<br>
<input type="radio" name="r14" value="r14" DISABLED>Radio 14
<br>
<input type="radio" name="r15" value="r15" DISABLED>Radio 15
<br>
<a href="javascript:enabledisable()">Enable / Disable</a>
</form>
</body>
</html>

w8ing 4 a good reply