CS101 Assignment No. 2 Spring 2012 (Solution)


Question 1         [20 marks]


Make a form in HTML document containing only one field named as Email and one Submit Button. Write your own JavaScript function to validate the email address.


The Validation should be as follows:


  1. It must accept only your VU Student email address i.e; it must not accept any other student’s VU email address.
  2. It must show alert on acceptance or denial of the email address after validation.
  3. The name of the function should contain your student ID like CheckEmail_BC102034568.
  4. If you enter your wrong student email id then it must show alert as well.
  5. It must accept your student ID only at vu.edu.pk, means if you enter BC102034568@hotmail.com then it must not accept it.
  6. There must be unique alerts for each error; like if the length of the student ID is larger or smaller than the original ID then the alert should be according to that.
  7. During each alert, the entered email address must also be shown in the alert box like: “BC102034560000008@vu.edu.pk is not your Valid Email address”


Hint: See the attached sample html file for simply checking @ and dot in an email address.


Download solution from that link.

CS101 Assignment. 02 Spring 2012


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s