In the onsubmit handler for your form, you pass the parameter "this", which correctly passes a reference to the form.
However you are passing "this" in the onBlur handler for the input. This passes a reference to the input field, not the form.
I would suggest changing
onBlur="checklen(this);"
to
onblur="checklen(this.form);"
to get a proper reference to the form - or rewrite the checklen function to expect an input as a parameter:
Code:
function checklen(input)
{
val = input.value;
len=val.length;
alert("writwe value");
if(len>10)
{
alert("value exceeds 10 character");
input.value="";
input.focus();
}
}
Bookmarks