logo
g Text Version
Auto
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Society & Culture
Sports
Travel & Leisure
TV & Movies

dailyclick
Bored? Games!
Postcards
Astrology
Take a Quiz
Rate My Photo

new
Journals
Folklore and Mythology
Business Coach
Marriage
Senior Living
Ethnic Beauty
Adolescence


dailyclick
All times in EST

Low Carb: 8:00 PM

Full Schedule
g
g HTML Site
Elizabeth Connick
BellaOnline's HTML Editor

g

Javascript Event Handlers

Event handlers are a vital tool for web developers, because they allow us to build a script that will run only if and when a specific event occurs. Introduced in HTML 4.0, they add a dynamic element to a website, allowing programs to run in response to your visitors' actions.

Event HandlerTrigger
onabortVisitor cancels a loading image
onblurAn element loses focus (e.g. visitor clicks out of a form field)
onchangeVisitor changes the content of a field
onclickVisitor clicks an object with the mouse cursor
ondblclickVisitor double-clicks an object
onerrorAn error occurs when loading a document or an image
onfocusAn element gets focus (e.g. visitor clicks on or tabs into a form field)
onkeydownVisitor presses a key
onkeypressVisitor presses or holds down a key
onkeyupVisitor releases a key
onloadA page or an image finishes loading
onmousedownVisitor presses the mouse button
onmousemoveVisitor moves the mouse
onmouseoutVisitor moves the mouse cursor off an element
onmouseoverVisitor moves the mouse cursor onto an element
onmouseupVisitor releases the mouse button
onresetVisitor clicks the Reset button of a form
onresizeVisitor resizes the frame or window
onselectVisitor selects a portion of text
onsubmitVisitor clicks the Submit button of a form
onunloadVisitor exits the page


You can insert event handlers directly into HTML tags, like this...

<input type="button" value="Click me!" onclick="alert('You clicked the button!')">

... which will produce the following effect:


RSS | Related Articles | Previous Features | Site Map

Add Javascript+Event+Handlers to Twitter Add Javascript+Event+Handlers to Facebook Add Javascript+Event+Handlers to MySpace Add Javascript+Event+Handlers to Del.icio.us Digg Javascript+Event+Handlers Add Javascript+Event+Handlers to Yahoo My Web Add Javascript+Event+Handlers to Google Bookmarks Add Javascript+Event+Handlers to Stumbleupon Add Javascript+Event+Handlers to Reddit


Content copyright © 2009 by Elizabeth Connick. All rights reserved.
This content was written by Elizabeth Connick. If you wish to use this content in any manner, you need written permission. Contact Elizabeth Connick for details.

g


For FREE email updates, subscribe to the HTML Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor

g features
What's Coming in HTML 5

What is FTP?

HTML Fundamentals - Tables

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter

jobs
what
job title, keywords
where
city, state or zip
jobs by job search


vote
Growing a Garden
Veggies and Flowers
Veggies Only
Flowers Only
No Garden

g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2009 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor