CS 330 Class 6 - PowerPoint PPT Presentation

1 / 4
About This Presentation
Title:

CS 330 Class 6

Description:

Our view is that event handlers are JavaScript code attached ... whoAmI=Frog&name=Freddy the Frog&warts=100. Can you think of any other use for a hidden field? ... – PowerPoint PPT presentation

Number of Views:84
Avg rating:3.0/5.0
Slides: 5
Provided by: cshil
Category:
Tags: class | warts

less

Transcript and Presenter's Notes

Title: CS 330 Class 6


1
CS 330 Class 6
  • Programming plan for today
  • Events.
  • Forms with hidden fields.
  • Form verification.

2
Events (15.1-15.2)
  • Event an action an operating system recognizes
    and a corresponding event handler
  • e.g. mouse button, incoming mail, a request to a
    server
  • P. 285 has a good list of the available events.
  • Our view is that event handlers are JavaScript
    code attached to attributes of HTML objects
  • ltbody onLoad alert(hi there)gt
  • ltinput type"button" value"Add "
    name"addButton"
  • onClick"addNumbers(this.form)"gt
  • Example focus.htm

3
Form with Hidden Fields
  • Example guesthid.htm
  • Allows user to select from different forms
  • The hidden field tells the server which form is
    sending the message
  • Response from frog.htm (mailed to me)
  • whoAmIFrognameFreddytheFrogwarts100
  • Can you think of any other use for a hidden field?

4
Form Verification (16.5)
  • Forms have input elements with event handlers
    that respond to user interaction
  • Event handlers are written in JavaScript
  • Will look at this in more detail now
  • Two approaches (guest3.htm)
  • Verify each element as it is added via onChange
    event
  • Verify the entire form as it is submitted to the
    server
  • Next step (CGI) forms and their data are
    submitted to a server for processing
Write a Comment
User Comments (0)
About PowerShow.com