W3101: Scripting Languages: Javascript -- HW1
Due: 9AM on Wednesday, Mar 11.
Please name the file as "yourname"-HW1.html and
submit the HTML file with your Javascript code
in Courseworks in the Dropbox/HW1 folder.
Consider the problem of filling out the form for opening an account
in a bank, that we discussed briefly in the class.
Follow the instructions given below to retrieve a template form.
Use the html template form given and complete it as follows:
- The form should have the following fields (in the body part):
- A text box called "First Name".
- A text box called "Last Name".
- A text box called "Preferred User Name".
- A text box called "Preferred password".
- A dropdown menu of the kind of account ---
possible choices are
(i) Checking account, (ii) returnSavings account (iii) IRA account
- A radio button called "Sex" with two values, "Male" and "Female".
- The values in the fields "First Name" and "Last Name" should be
mandatory. The function "onSubmitFn( )" is executed if the
"Submit" button is pressed. Complete the body of the "onSubmitFn( )"
(in the head part of the html file),
such that if "First Name" is blank, an alert box pops up saying
that it should have a valid name (of 1 or more characters).
Similary, if "Last Name" is blank, an alert box pops up saying
that it should have a valid name (of 1 or more characters).
Note:
- The name of this form is "bankform".
To retrieve the value of a text field in this form,
give it any name, (say "name") and get the value
using "document.bankform.name.value").
- After you enter valid values for "First Name"
and "Last Name", if everything works fine,
the form should try to open a page called,
"AcctCreation.html", when you press the
"Submit" button.
Instructions to get the template form
- Click here to
get the form.
- Click on the "View" button on top, and then press
"View Page Source". You will see the template form.
You can copy and paste it or save it as a file"
risukapalli
Last modified: Fri Mar 6 01:09:16 EST 2009