Vous êtes sur la page 1sur 7

Assignment No.

3 Total Marks: 20
Semester: FALL 2010
CS101 Introduction to Computing Due Date:
January 05, 2011

Instructions
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:

o Assignment is submitted after due date.


o Submitted assignment does not open or file is corrupt.
o Assignment is copied (From internet/ to from students).

Objective

The assignment has been designed to enable Students:

• Understanding HTML and JavaScript


• Understanding event handling in JavaScript
• Understanding the management of style sheet with the help to JavaScript

Software (s) Used to develop Assignment

Notepad

Assignment Submission Instructions

• The Assignment should be submitted in .html format.


• Do not submit an image of html document, it is not acceptable in any case.
• Do not submit assignment in text, MS-Word, pdf or any other format except html.
• Facing problem in creating html file, follow the procedure given at end of file How to create html
file.
Assignment

You are required to Design HTML layout, validate form fields and manage fields style with
the help of JavaScript. (20 Marks)

1. Layout

2. Validate Empty Field

If user will submit form without entering any value in GPA. Display warning message.
Change field background color to pink.
On clicking ok reset layout to initial state (White background, pointer focus on GPA field).

3. Validate Alphabetic Value


If user will submit form with alphabetic value. Display warning message.
Change field background color to red.
On clicking ok reset layout to initial state (White background, pointer focus on GPA field).

4. Validate Range of Value

If user will submit form with value less than 1 and greater than 4. Display warning message.
Change field background color to light sky blue.
On clicking ok reset layout to initial state (White background, pointer focus on GPA field).
5. Validate Correct Numeric Value

If user will submit form with value > = 1 and < 2. Display message “Fair :: You got D grade”.
If user will submit form with value > = 2 and < 3. Display message “Good :: You got C grade”.
If user will submit form with value > = 3 and < 4. Display message “Very Good :: You got B grade ”.
If user will submit form with value equal to 4. Display message “Excellent :: You got A grade ”.

Change field background color to lime.


6. Validate Find Grades Button

If value is > = 1 and <= 4, on clicking ok jump to www.vu.edu.pk


For any other value or empty field must not jump to www.vu.edu.pk

Hints:
1. For pink color use keyword pink.
2. For red color use keyword red.
3. For light sky blue color use keyword lightskyblue.
4. For lime color use keyword lime.
5. To change field background color use backgroundColor property of style sheet in JavaScript.
6. To set pointer focus on GPA field use JavaScript function focus.

Deadline:
Your assignment must be uploaded on or before January 05, 2011.
How to Create HTML File

1. Create new text file and write your code in it.

2. Save the file as given in image

3. Choose the location where you want to save your HTML file. Enter the name of
HTML file. Take care of starting and ending double quotes (“), these are
compulsory. Select “Save as type” field with value “All Files” and hit save.
HTML file is successfully created.

Vous aimerez peut-être aussi