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:
  1. The form should have the following fields (in the body part):
  2. 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).
  3. Note:
    1. 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").
    2. 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
risukapalli
Last modified: Fri Mar 6 01:09:16 EST 2009