Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Question 8</title>
- <script>
- function ValidateForm(){
- var regexNum = /\d/;
- var regexLetter = /[a-zA-z]/;
- var email = document.ContactForm.Email;
- var phone = document.ContactForm.Telephone;
- if (email.value == "")
- {
- window.alert("Please enter a valid e-mail address.");
- email.focus();
- return false;
- }
- if (email.value.indexOf("@", 0) < 0)
- {
- window.alert("Please enter a valid e-mail address.");
- email.focus();
- return false;
- }
- if (email.value.indexOf(".", 0) < 0)
- {
- window.alert("Please enter a valid e-mail address.");
- email.focus();
- return false;
- }
- if (phone.value == "")
- {
- window.alert("Please enter your telephone number.");
- phone.focus();
- return false;
- }
- if (isNaN(phone.value)){
- window.alert("Please enter a valid telephone number.");
- return false;
- }
- return true;
- }
- function phonenumber()
- {
- var phone = document.ContactForm.Telephone;
- var phoneno = /^\d{10}$/;
- if(phone.value.match(phoneno))
- {
- return true;
- }
- else
- {
- alert("Contact no. must be of 10 digits");
- return false;
- }
- }
- </script>
- </head>
- <body><font face="Helvetica">
- <h1><center>Question 8</h1><br /><br /></center>
- <form method="post" action="success.html";
- name="ContactForm" onsubmit="return ValidateForm() && phonenumber();">
- <p>Name: <input type="text" name="Name"></p>
- <p>Username: <input type="text" name="Username"></p>
- <p>Password: <input type="password" name="password1"></p>
- <p>Retype Password: <input type="password" name="password2"></p>
- <p>Gender:
- <input type="radio" value="male" name="gender">Male
- <input type="radio" value="female" name="gender">Female
- <input type="radio" value="other" name="gender">Other
- </p>
- <p>Programming Skills:
- <input type="checkbox" value="java" name="ps">Java
- <input type="checkbox" value="android" name="ps">Android
- <input type="checkbox" value="ruby" name="ps">Ruby
- <input type="checkbox" value="net" name="ps">.NET
- </p>
- <p>E-mail: <input type="text" name="Email"></p>
- <p>Contact No.: <input type="text" name="Telephone"><br>
- <p>College:
- <select type="text" value="" name="college">
- <option>SVIT</option>
- <option>New Eton</option>
- <option>St. Marys</option>
- <option>St. Esprit</option>
- <option>Eden</option>
- </select></p>
- <p><input type="submit" value="Submit" name="submit">
- </font>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement