Page 123 - DCAP202_Fundamentals of Web Programming
P. 123
Fundamentals of Web Programming
Notes
!
Caution If the field values are not accepted, the submit should be cancelled.
The function checkForm() returns either true or false. If it returns true the form will be submitted,
otherwise the submit will be cancelled:
onMouseOver and onMouseOut
onMouseOver and onMouseOut are often used to create “animated” buttons.
Example: Below is an example of an onMouseOver event. An alert box appears when an
onMouseOver event is detected:
<a href=”a.html” onmouseover=”alert(‘An onMouseOver event’);return false</a>
Task Compare and contrast onLoad and onUnload events.
Event Association
Events are associated with HTML tags. The definitions of the events described below are as
follows:
abort - A user action caused an abort of an image or document load.
blur - A frame set, document, or form object such as a text field loses the focus for input.
click - Happens when a link or image map is clicked on.
change - Happens when a form field is changed by the user and it loses the focus.
error - An error happened loading a image or document.
focus - A frame set, document, or form object such as a text field gets the focus for input.
load - The event happens when an image or HTML page has completed the load process in
the browser.
mouseOut - The event happens when the mouse is moved from on top of a link or image
map
mouseOver - The event happens when the mouse is placed on a link or image map.
reset - The user reset the object which is usually a form.
submit - The user submitted an object which is usually a form.
unload - The object such as a framesed or HTML document was exited by the user.
The events for each HTML tag are as follows:
<A>
click (onClick)
mouseOver (onMouseOver)
mouseOut (onMouseOut)
116 LOVELY PROFESSIONAL UNIVERSITY