[thelist] JavaScript onClick question.

Craig cd-ml at aardvark.net.au
Sun Aug 22 10:04:59 CDT 2004


If I have the following (simplified demo) page. [1]

Here is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>

<div onClick="alert('div onClick')">
 <a href="#" onClick="alert('a onClick');return false;">Link</a>

There is a DIV with an onClick alert, and a link with an onClick alert.
What happens is if you click on the Link, the JS alert will popup "a
onClick" and then "div onClick".

How can I make it only popup "a onClick" ??

Thanks for your help.

[1] - http://fx-scripts.com/test/testjs.htm


More information about the thelist mailing list