Lesson 8 Validation! |
1. |
Type the <form> tag that would be required if you wanted to: «use the post method to send the form to http://www..ed2go.com/cgi-bin/formpost.cgi «name the form trotwood «make the form capable of being validated by a function named waterbrook() each time the form's Submit button is pressed. |
S1 | <form method=”post” action=”http://www.ed2go.com/cgi-bin/formpost.cgi” name=”trotwood” onsubmit=”return waterbrook()”> |
2. | Type the if statement for a JavaScript validator function that would check to see if the value of a text box named steerforth on a form named trotwood is blank and, if so, causes: (a) an alert box containing the message "Error. Try again." to appear, and (b) returns the word "false" to the browser. |
S2 |
if (document.trotwood.steerforth.value == “ “) { alert (“Error. Try again.“); return false; } |
3. | Type the if statement for a JavaScript validator function that would check to see if the value of a checkbox named wickfield on a form named trotwood is not selected and, if not, causes: (a) an alert box containing the message "Check the box, please!" to appear, and (b) returns the word "false" to the browser. |
S3 |
if (document.trotwood.wickfield.checked == false) { alert (“Check the box, please!“); return false; } |