Guest_imported
New member
- Jan 1, 1970
- 0
Hello everyone,
I am new to this website and hope someone can me with this.
I have two input text boxes and want user to enter 3-byte long, if not, alert msg come up.
the problem is when user enter 2-byte and hit TAB key, the alert box is looping.
I appreciate any help
Thanks
<SCRIPT LANGUAGE="JavaScript">
function ValidateLen(input, x) {
if (input.value.length != x) {
alert('Field must be ' +x+ '-byte in length.');
input.focus();
input.select();
}
}
</script>
<form name="f1" id="f1" method="post" action="output">
<FONT FACE="Verdana" SIZE=2> <strong>Enter Old NPA:</strong>
<INPUT type="text" name="field1" size=03 maxlength=03
onBlur="ValidateLen(this, 3);"
<FONT FACE="Verdana" SIZE=2> <strong>New NPA:</strong>
<INPUT name="field2" size=03 maxlength=03
onBlur="ValidateLen(this, 3);"
<input type="button" value="Go!"
onClick="document.f1.submit();">
I am new to this website and hope someone can me with this.
I have two input text boxes and want user to enter 3-byte long, if not, alert msg come up.
the problem is when user enter 2-byte and hit TAB key, the alert box is looping.
I appreciate any help
Thanks
<SCRIPT LANGUAGE="JavaScript">
function ValidateLen(input, x) {
if (input.value.length != x) {
alert('Field must be ' +x+ '-byte in length.');
input.focus();
input.select();
}
}
</script>
<form name="f1" id="f1" method="post" action="output">
<FONT FACE="Verdana" SIZE=2> <strong>Enter Old NPA:</strong>
<INPUT type="text" name="field1" size=03 maxlength=03
onBlur="ValidateLen(this, 3);"
<FONT FACE="Verdana" SIZE=2> <strong>New NPA:</strong>
<INPUT name="field2" size=03 maxlength=03
onBlur="ValidateLen(this, 3);"
<input type="button" value="Go!"
onClick="document.f1.submit();">