...

View Full Version : Event when checkbox is selected



Michiel
12-27-2003, 04:47 PM
Hi all,

I've got a question about which eventhandler to use for the following issue:

I've got a checkbox and I want to make an alert when the checkbox is selected. Currently I've got the following code:

<input type="checkbox" onclick="alert('I\'m selected')">

When the checkbox is selected an alert pops up. However when I dis-select the checkbox an alert pops up as well.

Should I use another eventhandler (onselect or something??) or is there another workaround?

Thanx michiel

COBOLdinosaur
12-27-2003, 06:32 PM
onClick="if(this.checked) alert('I\'m checked');"

Michiel
12-27-2003, 06:43 PM
Thanx!

Cheers Michiel



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum