Forms (Part 2)
Forms Working With Scripts
Until scripting for web pages came along, CGIs were the only way to process form data. Now that Javascript is available on most web browsers, scripting provides a whole new avenue of neat ways to use forms. Unlike with CGI, forms that use scripts process the information immediately and can return the results right to the current web page. Script-based forms can also react to events other
than just the user pressing a "Submit" button.
An example of a script-only form is small form which sets the color of the current web page (works with IE5+ but not some other browsers):
This code |
Produces this |
<FORM>
<SELECT onChange="document.bgColor=this.options[this.selectedIndex].value">
<OPTION VALUE="FFFFFF">White
<OPTION VALUE="FF0000">Red
<OPTION VALUE="00FF00">Green
<OPTION VALUE="0000FF">Blue
</SELECT>
</FORM>
|
|
I hope this came in useful!
Ask in the forum
if you have any suggestions or comments.
|