Live Traffic

Sunday, May 1, 2011

Home » » JavaScript Object and Events

JavaScript Object and Events

The JavaScript Object Hierarchy

JavaScript Object and Events
Events

The object in a Web pages are organized in a hierarchy. All objects have properties and methods. In addition, some objects also have "events". Events are things that happen, usually user actions, that are associated with an object. The "event handler" is a command that is used tospecify actions in response to an event. Below are some of the most common events :
  • onLoad - occurs when a page loads in a browser
  • onUnload - occurs just before the user exits a page
  • onMouseOver - occurs when you point to an object
  • onMOuseOut - occurs when you point away from an object
  • onSubmit - occurs when you submit a form
  • onClick - occurs when an object is clicked
Events and Object

Event are things that happen, actions, that are associated with an object. Below are some common events and the object the are associated with :

Event Object
onLoad Body
onUnload Body
onMouseOver Link, Button
onMouseOut Link, Button
onSubmit Form
onClick Button, Checkbox, Submit, Reset, Link

Example : <FORM onSubmit="functionName()">

Image Rollover Example
  • With the "window.html" file open, View the Source
  • Put the cursor after the line "<A HREF=" and enter :
 <P>
 <A HREF="URL"
 onMOuseOver="document.hot.src='hot1.gif''"
 onMouseOut="document.hot.src='hot2.gif'">
 <IMG name="hot" src="hot2.gif"></A>

  • Save the changes and Refresh the Page.
ImageRolloverimageRollover

SEE VIDEO









source code : www.youtube.com

0 komentar:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More