Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript checking for correct input.

Status
Not open for further replies.

talksr

IS-IT--Management
Nov 2, 2007
10
0
0
Hello, i have a page working which checks details entered in a user details registration page.
The user has to input among other things such as name, their user id number.

So the form asks for their number:

<p>Your Employee number:
<input type="text" name="emp_no" SIZE="7" MAXLENGTH="7"></p>
Then the js will go through a set of if statements for everything so if nothing is entered for name, return false, which will make a popup show asking for the user to enter the details.

MY QUESTION is how can I get my program to check that the employee number entered is a number?
This is what it looks like at present:

if ( document.employee_details.emp_no.value == "") <!-- if num is also blank (" ") -->
{
alert ( "Please fill in employee number in the 'Your employee no' box." );
valid = false; <!-- If valid is equal to false -->
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top