Hi,I am trying to verify form input for length(before that I would like to trim it)
How can I do that for user

function verify(){
var user=document.getElementById("user");
var pass=document.getElementById("pass");
var msg= "";
document.write("Length "+user.length);
if(user.value == ""){
  msg+= "Please enter a username!\n";
  user.className = "inpBoxError";
if(pass.value == ""){
  msg+= "Please enter a password!\n";
  pass.className = "inpBoxError";
  if(msg == ""){
  return true;
  return false;
<table border="0">
<form action="index.htm" method="post" onSubmit="return verify();">
<tr colspan="2" allign="center"><td> Form Name</td></tr>
<td><input type="text" name="user" id="user" class="inpBox"></td></tr>
<td><input type="password" name="pass" id="pass" class="inpBox"></td></tr>
<tr><td colspan="2"  align="center">
<input type="submit" value="Enter" name="submit"></td></tr>

line 5: user.value.length
will give you the length of the string in the text box, though you've probably figured this out by now