Click here to Skip to main content
15,891,951 members

Acessing textbox in usercontrol

Revision 3
This is my ascx code:
XML
<script language="javascript" type="text/javascript">
           function fnMsg() {
               var value = document.getElementById('txt').value

           }
       </script>


HTML
<input id="txt" style="WIDTH: 12%"  type="text" maxlength="10" name="txt"  runat="server"/>
  <input type="button"  runat="server" value="click"  önclick="fnMsg();" style="width: 33px" />


I couldnt get the value of text box in javascript.

The error is document.getElementById('txt') is undefined.

Is there anyway to access the value
Posted 14-Nov-12 20:40pm by Divya RS.