PATH: Instructional Server> GRA 3758> Projects>

GRA 3758 Project 5 - JavaScript Object Manipulation


Project Purpose:

This project is intended to give students experience in composing a small web page involving the manipulation of objects using JavaScript. Although many different techniques exist for coding and executing scripts, this project will require that the script be coded as a [function] in the head section of an XHTML file. This program will rely primarily on the use of pop-up prompt (dialog) boxes for input and will produce HTML output using JavaScript document.write methods. See the [W3Schools tutorial page about JavaScript Popup Boxes]. As with prior projects, this project will be written using a plain text editor to help students develop a fundamental understanding of XHTML and JavaScript syntax.

Program (Script) Objective:

The script shall request and store a customer's first name, last name, and social security number (SSN). Both names may be entered in any case letters. The SSN must be entered using only digits (without hyphens). Generate an account name by concatenating the last four digits of the SSN to the end of the first four characters of the customer's last name in lowercase. Generate a password by concatenating the first four characters (in lowercase) of the customer's first name to the end of the first five digits of the SSN. For example, a customer named "Janet Wilson" with a SSN of "123456789" would be assigned an account name of "wils6789" and a password of "12345jane". For customers with names shorter than four characters, use just the letters provided (understanding that the resulting account name or password may be shorter than standard). Finally, display those results in the browser window in a manner similar to that shown in the OUTPUT area of the Sample Output below.

Sample Output:

Initially, your browser window should display:

Account Generating Program.


This web page can generate a customer account name and password, constructed from data related to the customer's identity. A script on the page will request and store a customer's first name, last name, and social security number (SSN). Both names may be entered in any case letters. The SSN must be entered using only digits (without hyphens). The script will generate an account name by concatenating the last four digits of the SSN to the end of the first four characters of the customer's last name in lowercase. Generate a password by concatenating the first four characters (in lowercase) of the customer's first name to the end of the first five digits of the SSN. For example, a customer named "Janet Wilson" with a SSN of "123456789" would be assigned an account name of "wils6789" and a password of "12345jane". For customers with names shorter than four characters, the script will use just the letters provided. The results will appear in the browser window after the customer data has been entered. Click on the button below to start the process.

To produce the button above, include the source code:

<form action="">
 <input type="button" value="Create account credentials" onclick="createUserid()"/>
</form>

The onclick event handler will run a script that you write in the head section named createUserid() that will generate the account credentials. After your script has acquired the following data with prompt dialog boxes

your browser window's contents should be altered to display:

Account Generating Program.


First Name: Janet
Last Name: Wilson
Social Security #: 123456789

Username: wils6789
Password: 12345jane

Note that the header and horizontal rule do not change; but all content below that does.

Project Constraints and Objectives:

Tips:

Submission:

Login to the and use the Project 5 drop box under the Lessons tab to attach your "project5.htm" file.

PATH: Instructional Server> GRA 3758> Projects>