Click here to Skip to main content
16,018,418 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
function maxlen()
{
var radioButtons = document.getElementsByName("rbtnPloicyType");

for (var x = 0; x < radioButtons.length; x++) {

if (radioButtons[x].checked) {

var selectedvalue = radioButtons[x].value;
}

}
}

<asp:TextBox ID="txtRegistrationNo" runat="server" MaxLength="100" CssClass="textfield" Width="200px" onchange="return RegistrationRTO(this)" önblur="return maxlen(this);">


Regadrs,
rahul.
Posted

Probably you just tend to mistype things. :-) This way, you could mistype the name, exactly as you mistype things in your question, and than the result of document.getElementsByName could return undefined value, which indicates the "not found" condition. Please check. If possible, use a Javascript debuggers.

—SA
 
Share this answer
 
Hi Try like this..

XML
<script type="text/javascript">

       function maxlen() {
           var rb = document.getElementById("<%=rbtnPloicyType.ClientID%>");
           var inputs = rb.getElementsByTagName('input');
           var flag = false;
           var selected;
           for (var i = 0; i < inputs.length; i++) {
               if (inputs[i].checked) {
                   selected = inputs[i];
                   flag = true;
                   break;
               }
           }
           if (flag)
               alert(selected.value);


       }




   </script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900