179
rated 0 times
[
185]
[
6]
/ answers: 1 / hits: 7412
/ 11 Years ago, mon, december 2, 2013, 12:00:00
I am trying to read the length of a textbox from my register form. I have tried using document.getElementById() and textbox.value.length. Is there something very simple I'm am missing. I alert the result to the screen to show the textbox length. Thanks in advance.
Here is my last attempt:
function Register(){
Alert(RegisterForm.txt_Password.value.length);
}
TextBox structure:
<form id=RegisterForm name=RegisterForm method=POST action=RegisterInsert.php onsubmit=return Register(RegisterForm)>
<table border=0 align=center width=100%>
<tr>
<td width=15%>Email Address:</td>
<td width=85%><input type=text name=txt_Email id=txt_Email/> </td>
</tr>
<tr>
<td width=15%>Username:</td>
<td width=85%><input type=text autocomplete=off name=user_name id=user_id class=user_name >
<span class=check ></span></td>
</tr>
<tr>
<td width=15%>Password:</td>
<td width=85%><input type=password name=txt_Password id=txt_Password /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type=submit name=btn_Register id=btn_Register value=Register></td>
</tr>
<tr>
</table>
<p> </p>
</form>
I use the submit button to call the Register function.
More From » javascript