Académique Documents
Professionnel Documents
Culture Documents
3
Lab 03 Overview..................................................................................................... 3
Lab 03 Part 1 - Form onsubmit Event....................................................................4
Task 1: Create form.............................................................................................. 4
Task 2: Create onsubmit event.............................................................................4
Task 3: Demonstrate work.................................................................................... 4
Lab 03 - Part 2 - Form Validation.............................................................................5
Task 1: Download Web Application.......................................................................5
Task 2: Implement Order Form Validation............................................................5
Task 3: Implement Delivery Form Validation........................................................6
Task 4: Implement Payment Form Validation........................................................7
Task 5 Submission............................................................................................. 7
Lab 03 Part 3 Enhance JavaScript Game............................................................8
Lab 03 Part 3.1 - Enhance JavaScript Game.......................................................8
Task 1: Review and understand the application................................................8
Task 2: Port the application to your system.....................................................9
Task 3: Change the card images.......................................................................9
Task 4: Add a Start Game button......................................................................9
Task 5: End of game message...........................................................................9
Task 6: Fix the Reveal Images feature.............................................................10
Lab 03 Part 3.2 Implement JavaScript Cookies..............................................10
JavaScript Cookies Reference..........................................................................10
Task 1: Implement Enhancement....................................................................10
User Interface and Functional Requirements:..............................................10
Add three forms fields:.................................................................................10
Page load:.................................................................................................... 10
Start game:.................................................................................................. 11
End of game:................................................................................................ 12
Cookie Format Specifications:......................................................................12
Part 3 Submission............................................................................................ 12
Lab 03 Grading Scheme........................................................................................ 13
Part 1.................................................................................................................. 13
Part 2.................................................................................................................. 14
Part 3.1............................................................................................................... 15
Part 3.2............................................................................................................... 16
Lab 03 JavaScript
Lab 03 Overview
Lab 03 consists of three parts:
Lab 03 is worth 6.5% of your final grade where the marks are distributed as follows:
Present a final confirmation window to the user before the form data is
submitted to the server for processing. The confirm window will allow the
user to proceed if he/she clicks OK or to cancel the form submission when the
cancel button is clicked.
Task 5 Submission
Zip up your application (include all web application files) and submit to Blackboard
before the due date.
You should step through the code to understand different use cases and help
you understand the code, for example:
Game start;
No cards matched;
Cards matched;
End of game;
Select an already match card.
Please note that HTML and JavaScript code modifications will be required to
support the above directory structure.
Task 3: Change the card images
Create your own game card images.
Task 4: Add a Start Game button
Add a button labeled Start Game such that the Elapsed Time remains at zero
(0) until the user has clicked the Start Game button.
Prevent a user from flipping a card unless the game has been started.
Present the user with a warning should he/she try to flip a card before the
game has been started.
Hint: Consult the Lab 03 Part 3.1 Task 4 Hints document.
Task 5: End of game message
Display an end of game message via an alert window where the message
content is based on the game score.
Here are sample messages:
Page load:
Add the following page Onload event processing:
No
Start game:
Do not allow a user to start a game with an empty, null, undefined, spaces or
length = 0 User value. Implement the following functionality should any of
the latter conditions be true:
Prompt the user (via a prompt window) for a game user id until the
user has entered a !(empty, null, undefined, all spaces or length=0)
value.
Create cookie for user, setting last and high score values to 0%.
For example, lets say the user entered chimp as the user id. You
would write the following cookie:
o Cookie name: userscore
o Cookie value: chimp,0%,0%
End of game:
1. At the end of the game, update (on-screen and cookie) the users last
and high score where:
a. Last score = current game score
b. High score = the greater of the (current game score and current
high score)
Cookie Format Specifications:
Cookie name:
userscore
Cookie value: userid,lastscore%,highscore%
o Note that the userid, last and high score values are comma
separated. Use the string split method to separate the cookie
value into three separate parts: userid, lastscore and highscore.
Cookie expiry: 1 year
Note that the cookie mechanism being implemented does not allow a
browser to maintain more than one users score.
Part 3 Submission
Zip up your application (include all web application files) and submit to Blackboard
before the due date.
type=tel
type=email
5. form elements .1
Input tag: id, type and name attributes
If used, label tag: for attribute value matches control id value
select tag
Part 2
1.3 points
Deductions are indicated with ######
Task 2: Order form .65
onload and reset events: Todays date written in date field .
.22
onsubmit event: Must not be able to move to the next form unless: .21
Alert message is presented if validation fails!
User selected product with a NON zero quantity
Selected shipment method.
An onchange event (on product type, quantity and shipment): recalculates
the product, shipment, subtotal, taxes and total price values. .22
Part 3.1
2.6 points
Task 2: Application runs locally /.52
Part 3.2
1.3 points