BW Network
    Login | Register 

Stats
3 visitors online
Guests: 3
Registered: 0



SafeSurf Logo

Website BuildingTutorials → Javascript: Forms (Part 4)

Forms are used to allow the client (visitor) to input data. Form inputs include: Text boxes, textareas, buttons, radio boxes, check boxes, password boxes and pulldown menus.

Form Example

<form name="testform" action="#" method="post" onSubmit="submitdata()">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit" value="Submit!">
</form>

Click here to see what this form looks like!

The form action attribute usually specifies a cgi, asp or php file to handle the data. In this case however Javascript is selected, and although I have not written the submitdata() function by the end of this tutorial you should be able to do so. In fact, next you will learn how to write a simple username and password login script!

The way this script will work is the entrance page will have a form on it asking for the visitor's username and password. When they click a submit button the contents will be verified by a javascript and if the information is correct the user will be able to enter.

→ Login Script →


  1. Introduction
  2. Part 1: Further Introduction
  3. Part 2: Basic Implementation
  4. Part 3: Strings & Variables
  5. Part 4: Forms
  6. Part 5: Login Script