HTML and CSS Reference
In-Depth Information
EXAMPLE 11.10 ( CONTINUED )
<body>
2
<form action="http://cgi-bin/testform.cgi"
method="post">
Enter your user id:
3
<input type="text"
name="textbox"
value="" />
<br />
Type your password:
<input type="password"
name="secret" />
<p></p>
4
<input type="submit"
onClick="readySubmit();" />
</form>
</body>
</html>
EXPLANATION
1
The JavaScript function called readySubmit() is defined. It will display a confirm
dialog box. If the user clicks OK, a true value will be returned and the form will
be submitted. If the user clicks Cancel, false will be returned, and the form will be
stopped (see Figure 11.19).
2
The form starts here. When submitted, it will go to the server-side CGI program.
The URL of the CGI program is assigned to the action attribute of the HTML
<form> tag.
3
The input types for this form are a text field and a password field.
4
When the user clicks the submit button, the onClick event handler is triggered. It
will handle the event by invoking the JavaScript function called readySubmit() .
Figure 11.19 Submitting a form and the onClick event.
 
Search WWH ::




Custom Search