1. Mid-Term Exam
Internet Programming
Date:Oct 21 2011
Submission Deadline: Oct 26 12 Midnight KST.
Name:
Student Id:
Note: Your code will be evaluated based on the following:
1. It should contain comments so that any one who read the code would be able to understand what a particular statement is doing.
2. The variable names should not be chosen at random, i.e. they should make sense. For ex: for user name, one of the variable name can be userName.
3. The GUI should be presentable, you should extensively use CSS wherever it is possible.
NB: If two codes are correct, then the code that is more presentable will get higher marks.
Q1. Write a html/javascript program that does the following
A form has the following form elements: Name, Student Id, Address. There is no Submit button, and reset button.
For the address make a drop down box for the Country Name.
The country drop down box has the following options Korea, Japan, China.
If a user selects the country name as Korea, a new drop-down box should dynamically be generated on the fly. This drop-down box shows the cities that user can select from. For ex: if user selects country Korea, then cities could be
Suwon, Seoul, Busan, etc. You can choose as many cities you want but there should be at least 3 cities to choose from.
After a user successfully select the Country Name, City Name, a text box should dynamically appear to accept input about street address, House number and apartment name.
Do the following form validation:
1. Name should begin with an alphabet and should not contain any number. For ex: the following are invalid: 123,12abc, ab12, a123b, etc.
2. No spaces in name, for ex: the following is invalid: Jung Hun, Kim Yu Na. the following are valid: JungHun, KimYuNa.
3. Student id should consist of all numbers i.e. no alphabets should be embedded.
4. Street name, house number, and apartment name should not be empty
5. Name should not be empty
6. Student id should not be empty.
If a user clicks on the textbox for studentid, it should display the following: Enter your student id.
If a user clicks on the textbox for name, it should display the following: Enter your name without any spaces
If a user clicks on the textbox for address, it should display the following: Enter street name, house no, and apartment name.
The validation function for name should execute when the keyboard focus or mouse focus leaves the student text-box
The validation function for studentid should execute when the keyboard focus or mouse focus leave the studentid text-box
The validation function for address textbox should execute when the keyboard focus or mouse focus leaves the address textbox.
If user name has spaces, you can ask the user shall I remove spaces from it, for ex: if user enters the name as Kim Yu Na, then you can ask the user if system can correct it for him by changing name to KimYuNa.
Your code should contain functionality for correction of name if it contain spaces. This code should execute when mouse focus or keyboard focus leaves the student name textbox.
Q2. Write a html/javascript program that does the following
Make 6 boxes as a 2 row x 3 col matrix. i.e. there are 2 rows and each row has 3 columns.
Each box has a hidden card.
3 pair of boxes, each pair has the same card number.
Card numbers are assigned randomly.
In the beginning all cards are hidden.
When user click on a box, it flips and shows the card no.
When user clicks on another box, it flips and shows the card no.
If the card no in both the boxes match, they disappear and an empty slot appears.
if the card no don't match, they flip and hide the number.