[thelist] {Spam?} JavaScript onClick question.

Craig Dyer craig at aardvark.net.au
Sun Aug 22 09:59:07 CDT 2004


Hi,

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

Here is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

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

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

Regards,
Craig.




More information about the thelist mailing list