cancer10
05-08-2008, 12:45 PM
Hi
Plz consider the following JS code. This code will alert you with the value of the radio button that is selected. This code works perfectly fine..
<script>
function deletecID(){
for (i=0;i<document.frmlist.intDeleteValue.length;i++){
if (document.frmlist.intDeleteValue[i].checked==true){
var deleteID =document.frmlist.intDeleteValue[i].value
alert(deleteID);
}
}
}
</script>
<form name="frmlist">
<input type=radio name="intDeleteValue" value="1">
<input type=radio name="intDeleteValue" value="2">
<input type=button onclick="deletecID()">
</form>
Now, take a look into the following code. This code does not work. Its the same code as above but the only difference is that it just have one radio button in the form.
<script>
function deletecID(){
for (i=0;i<document.frmlist.intDeleteValue.length;i++){
if (document.frmlist.intDeleteValue[i].checked==true){
var deleteID =document.frmlist.intDeleteValue[i].value
alert(deleteID);
}
}
}
</script>
<form name="frmlist">
<input type=radio name="intDeleteValue" value="1">
<input type=button onclick="deletecID()">
</form>
Any JS gurus here can tell if this is a bug in JS? Is there a solution to this?
Thanx
Plz consider the following JS code. This code will alert you with the value of the radio button that is selected. This code works perfectly fine..
<script>
function deletecID(){
for (i=0;i<document.frmlist.intDeleteValue.length;i++){
if (document.frmlist.intDeleteValue[i].checked==true){
var deleteID =document.frmlist.intDeleteValue[i].value
alert(deleteID);
}
}
}
</script>
<form name="frmlist">
<input type=radio name="intDeleteValue" value="1">
<input type=radio name="intDeleteValue" value="2">
<input type=button onclick="deletecID()">
</form>
Now, take a look into the following code. This code does not work. Its the same code as above but the only difference is that it just have one radio button in the form.
<script>
function deletecID(){
for (i=0;i<document.frmlist.intDeleteValue.length;i++){
if (document.frmlist.intDeleteValue[i].checked==true){
var deleteID =document.frmlist.intDeleteValue[i].value
alert(deleteID);
}
}
}
</script>
<form name="frmlist">
<input type=radio name="intDeleteValue" value="1">
<input type=button onclick="deletecID()">
</form>
Any JS gurus here can tell if this is a bug in JS? Is there a solution to this?
Thanx