HTML Forms and Scripts
Download
Report
Transcript HTML Forms and Scripts
HTML Forms and Scripts
Session overview
• What are forms?
• Static vs dynamic
• Client-side scripts
– JavaScript
HTML Forms
• HTML Forms were the first way for users to
interact with the Web
– controls (input fields)
– form submission
– form processing (nothing to do with HTML!)
HTML Forms
<FORM…>
–
–
–
–
–
action
method
enctype
accept
accept-charset
Static vs Dynamic
• Static
– page appears exactly as it was encoded, nothing
changes
• Dynamic
– page is compiled, or able to be changed
Scripts: server-side vs client-side
• Server-side
– the first type possible on the Web
– action occurs at the server
• Client-side
– generally easier to implement
– may be prepared and implemented offline
– action occurs on the client side (browser)
Examples of client-side scripts
• JavaScript (most common)
• VBScript (Microsoft)
• Java applets - can be server-side or clientside
Embedding scripts in HTML
<SCRIPT…>
• can appear anywhere in the HTML
document (but best in the <HEAD>)
• the script can be linked (like a separate style
sheet)
<script type=“text/javascript”
language=“JavaScript” src=“rollovers.js”>
JavaScript
• Can be used to make Web page tricks like
image rollovers, form validation,
calculations etc…
• Developed by Netscape to be simple, crossbrowser scripting language for Web
• Syntax based on ‘C’ - a good starting point
to learn other programming languages
• JavaScript is not Java
Example: JavaScript rollover...
• Satellite Dispatch
(http://www.toysatellite.org/news)
Dynamic HTML / dHTML / DHTML
• HTML elements (or objects) that can
change after the document has loaded in
browser
• DHTML = HTML+CSS + scripts
(generally, JavaScript)
Example: Dynamic HTML
• Auslaender Micro
http://www.toysatellite.org/agarton/MA/proj
ect/micro02/splash.htm