Saturday, April 4, 2009

JavaScript Events

onblur Event

  • The onblur event occurs when an object loses focus.
  • E.g. Make input uppercase.
  • Applies to: button, checkbox, fileUpload, layer, frame, password, radio, reset, submit, text, textarea, window

onkeydown Event

  • The onkeydown event occurs when a keyboard key is pressed.
  • E.g. user cannot type numbers into the input field
  • Applies to: document, image, link, textarea, text

onfocus Event

  • The onfocus event occurs when an object gets focus.
  • E.g. make the background color of the input fields change when they get focus.
  • Applies to: button, checkbox, fileUpload, layer, frame, password, radio, reset, select, submit, text, textarea, window

onkeypress Event

  • The onkeydown event occurs when a keyboard key is pressed or held down.
  • E.g. user cannot type numbers into the input field
  • Applies to: document, image, link, textarea, text

ondblclick Event

  • The ondblclick event occurs when an object gets double-clicked.
  • E.g. Copy field A's text to field B when a button gets double-clicked.
  • Applies to: button, document, link

onmouseover Event

  • The onmouseover event occurs when the mouse pointer moves over a specified object.
  • E.g. display an alert box when the user moves the mouse pointer over an image.
  • Applies to: layer, link, image

onmouseout Event

  • The onmouseout event occurs when the mouse pointer moves away from a specified object.
  • E.g. display an alert box when the user moves the mouse pointer away from an image.
  • Applies to: layer, link, image

onmousedown Event

  • The onmousedown event occurs when a mouse button is clicked.
  • E.g. an alert box is displayed when clicking on an image.
  • Applies to: button, document, link, image

onmouseup Event

  • The onmouseup event occurs when a mouse button is released.
  • E.g. an alert box is displayed when the mouse button is released after clicking an image.
  • Applies to: button, document, link, image

Reference:

JavaScript Event Reference

blog comments powered by Disqus