Web Hosting Directory | Web Hosting Resources | Webmaster Resources | Domain Tools | Search Engine Marketing | Forums
  Signup
Today: 652   Yesterday: 853   Max: 1,872   Total: 385,968   Current Users : 15 (Member 0) 
DOMAIN TOOLS

WEBMASTER TOOLS

RELATED ARTICLES

SUBMIT AN ARTICLE

Write for us and get publicity, link to your website, and best of all get paid. Please visit our writers page for details.


LINK TO US

Link to us and earn points for each visitor you bring to us. Please visit our link partner page for details.

 

Attribute for <AREA ...>
onClick = "script command(s)"

Usage Recommendation
use it, but don't rely on it

Looking for info on how to make an image map?

See our tutorial How to Make an Image Map
Like <A onClick="..."> and <INPUT onClick="...">, <AREA onClick="..."> performs a dual function: it allows you to run a script when the users clicks on the area, and it allows you to cancel the action that click would otherwise have performed.

In its simplest use, onClick runs a script when the user clicks on the area. For example, the following code brings up an alert box when the user clicks on the Freelance area:

<AREA HREF="freelance.php" ALT="Freelance" 
    COORDS="31,0,164,26" SHAPE=RECT
    onClick="alert('That was a click')">

which gives us the onClick in the Freelance area:

Freelance Albums Jobs Log Out Home Image Map

If onClick returns a false value then the click is cancelled. For example, you might want to check if the user really wants to follow the link. By returning the value of a confirm() command you can cancel or allow the click based on the user's response:

<AREA HREF="logout.php" ALT="Log Out" 
    COORDS="3,59,37,88" SHAPE=RECT
    onClick="return confirm('Are you sure you want to log out?')">

which gives us the onClick in the Logout area:

Freelance Albums Jobs Log Out Home Image Map



Copyright 1997-2002 Idocs, Inc. Written by Miko Sullivan.

 
 
What is your major source of website traffic?
 
 
 
 
 
 

ADVERTISEMENT

 
Cheap Web HostingBudget Web HostingEcommerce Web Hosting
Link to UsLink ExchangeAdvertisePrivacy PolicyTerms Of ServiceAbout UsContact UsSitemap
Copyright © 2006 - 2008 Broadband Media, Inc. All rights reserved.