473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Detecting status change in a checkbox

I'm not really good with javascript, basically what I'm trying to do
is that I want to be able to handle when the status of a checkbox is
changed (i.e. checked or unchecked), I see everybody is using onclick
but I wonder if this is the correct approach, what if a user changes
the status of the checkbox using the keyboard, will onclick be
triggered? I know I might sound a little picky here but I believe
those people who created DHTML must've thought about this, right?

Sorry if I posted the question in the wrong group, I couldn't find a
good group for DHTML, I assume many people post questions about DHTML
here as javascript and DHTML are very related, anyway a post in the
wrong group is still better than all this spam I see everywhere here!
Sep 29 '08 #1
2 2867
Never mind guys, I just realized that onclick is also triggered when
the user checks/unchecks the checkbox using the keyboard ...
Sep 29 '08 #2
waleed wrote:
I'm not really good with javascript, basically what I'm trying to do
is that I want to be able to handle when the status of a checkbox is
changed (i.e. checked or unchecked), I see everybody is using onclick
but I wonder if this is the correct approach, what if a user changes
the status of the checkbox using the keyboard, will onclick be
triggered?
I think that onChange is what you want. I was tinkering with some
onChange code for RADIO buttons recently, and discovered that onChange
seems to trigger for radio buttons only when they change from unchecked
to checked. There is some sense in this, otherwise you'd often get two
events each time a button was changed (the other one coming from the
button which got unchecked).

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Sep 29 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alex | last post by:
Hi all... I have a DataGrid bound to a DataTable. My DataTable gets updated programmatically as it contains the status of a number of worker threads. Each "main" worker thread launches a...
2
by: epigram | last post by:
I have a form on a web page that contains several textbox controls (i.e. input type="text") and a checkbox. As soon as the text changes, in only a subset of these textbox controls, I want to...
1
by: Vannela | last post by:
I want to get the status of the checkbox control in the item template of the DataList in the code behind Using findcontrol i am not able to get the status of the checkbox . How shouls i get the...
1
by: Chen Sun via .NET 247 | last post by:
I have a datagrid with a checkbox column, if i check onecheckbox, and then change to another page, when i go back to theprevious page, the checkbox that i have marked is uncheckedagain, is there...
0
by: Julius Fenata | last post by:
Thx to Mr. Gaurav, I have follow your instructions and thanks for your help, the checkbox change status when has a first click on it, but.. when I repeatedly clicking on it, the value doesn't...
1
by: Dean Slindee | last post by:
In my application there is a main form with a tabcontrol. On each page in the tabcontrol is a panel upon which is painted a "sub" form. The main form acts as the "application host", while the...
1
by: topmind | last post by:
I couldn't get the status bar to work in Netscape 8.1. The JavaScript settings are set to allow it, but it just ain't no work. Here is a Plain Jane test script. I added an Alert box to make sure...
4
by: Steve | last post by:
I know this must be a lame question, but I ask it after a lot of searching and experimentation. I can not get a string to print into the status bar of a Firefox browser. Is it the case that if...
3
by: dbuchanan | last post by:
How, at rundime, do I capture the fact that the parametrized query that fills a CheckBoxList results in an empty set. When the dataset is empty the CheckBoxList does not appear. I would like to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.