473,398 Members | 2,404 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,398 software developers and data experts.

input checkbox onchange not working on IE7

I am finding that <input type="checkbox" onchange="alert('test')"></input>
does not seem to work properly on IE7.

http://www.aarongray.org/Test/JavaScript/checkbox.html

It works fine on FF and Google Chrome.

Any suggestions ?

Many thanks in advance,

Aaron
Oct 30 '08 #1
7 22957
On Oct 30, 3:17*pm, "Aaron Gray" <ang.use...@gmail.comwrote:
I am finding that <input type="checkbox" onchange="alert('test')"></input>
does not seem to work properly on IE7.
Use the click event with checkboxes. I think you will find that in
some browsers the change event fires only after the input loses focus.
Oct 30 '08 #2
"David Mark" <dm***********@gmail.comwrote in message
news:2a**********************************@f77g2000 hsf.googlegroups.com...
>On Oct 30, 3:17 pm, "Aaron Gray" <ang.use...@gmail.comwrote:
>I am finding that <input type="checkbox"
onchange="alert('test')"></input>
does not seem to work properly on IE7.

Use the click event with checkboxes. I think you will find that in
some browsers the change event fires only after the input loses focus.
Okay great 'onclick' works but how do Iget the checkbox'es value ?

<input type="checkbox" onchange="alert('test' + this.value)"></input>

Is always giving 'on'.

Thanks,

Aaron
Oct 30 '08 #3
On 30 Ott, 20:26, "Aaron Gray" <ang.use...@gmail.comwrote:
"David Mark" <dmark.cins...@gmail.comwrote in message

news:2a**********************************@f77g2000 hsf.googlegroups.com...
On Oct 30, 3:17 pm, "Aaron Gray" <ang.use...@gmail.comwrote:
I am finding that <input type="checkbox"
onchange="alert('test')"></input>
does not seem to work properly on IE7.
Use the click event with checkboxes. *I think you will find that in
some browsers the change event fires only after the input loses focus.

Okay great 'onclick' works but how do Iget the checkbox'es value ?

* * <input type="checkbox" onchange="alert('test' + this.value)"></input>

Is always giving 'on'.

Thanks,

Aaron
simply put a value attribute on it
<input type="checkbox" value ="some_value" onclick="alert('test' +
this.value)"></input>

Bye

Oct 30 '08 #4
On Oct 30, 3:35*pm, xdevel1999 <xdevel1...@gmail.comwrote:
On 30 Ott, 20:26, "Aaron Gray" <ang.use...@gmail.comwrote:
"David Mark" <dmark.cins...@gmail.comwrote in message
news:2a**********************************@f77g2000 hsf.googlegroups.com....
>On Oct 30, 3:17 pm, "Aaron Gray" <ang.use...@gmail.comwrote:
>I am finding that <input type="checkbox"
>onchange="alert('test')"></input>
>does not seem to work properly on IE7.
>Use the click event with checkboxes. *I think you will find that in
>some browsers the change event fires only after the input loses focus.
Okay great 'onclick' works but how do Iget the checkbox'es value ?
* * <input type="checkbox" onchange="alert('test' + this.value)"></input>
Is always giving 'on'.
Thanks,
Aaron

simply put a value attribute on it
What on earth are you talking about?
Oct 30 '08 #5
On Oct 30, 3:26*pm, "Aaron Gray" <ang.use...@gmail.comwrote:
"David Mark" <dmark.cins...@gmail.comwrote in message

news:2a**********************************@f77g2000 hsf.googlegroups.com...
On Oct 30, 3:17 pm, "Aaron Gray" <ang.use...@gmail.comwrote:
I am finding that <input type="checkbox"
onchange="alert('test')"></input>
does not seem to work properly on IE7.
Use the click event with checkboxes. *I think you will find that in
some browsers the change event fires only after the input loses focus.

Okay great 'onclick' works but how do Iget the checkbox'es value ?

* * <input type="checkbox" onchange="alert('test' + this.value)"></input>

Is always giving 'on'.
Perhaps you meant onclick above? Also, the checked property is likely
what you are after. Do you really care about the value?
Oct 30 '08 #6
"David Mark" <dm***********@gmail.comwrote in message
news:dd**********************************@f63g2000 hsf.googlegroups.com...
On Oct 30, 3:26 pm, "Aaron Gray" <ang.use...@gmail.comwrote:
>"David Mark" <dmark.cins...@gmail.comwrote in message

news:2a**********************************@f77g200 0hsf.googlegroups.com...
>On Oct 30, 3:17 pm, "Aaron Gray" <ang.use...@gmail.comwrote:
I am finding that <input type="checkbox"
onchange="alert('test')"></input>
does not seem to work properly on IE7.
>Use the click event with checkboxes. I think you will find that in
some browsers the change event fires only after the input loses focus.

Okay great 'onclick' works but how do Iget the checkbox'es value ?

<input type="checkbox" onchange="alert('test' + this.value)"></input>

Is always giving 'on'.
>Perhaps you meant onclick above?
Yes, sorry :)
>Also, the checked property is likely what you are after.
Ah, got that :)
>Do you really care about the value?
No.

Thanks alot David,

Aaron
Oct 30 '08 #7
On Oct 30, 4:15*pm, "Aaron Gray" <ang.use...@gmail.comwrote:
"David Mark" <dmark.cins...@gmail.comwrote in message

news:dd**********************************@f63g2000 hsf.googlegroups.com...
On Oct 30, 3:26 pm, "Aaron Gray" <ang.use...@gmail.comwrote:
"David Mark" <dmark.cins...@gmail.comwrote in message
>news:2a**********************************@f77g200 0hsf.googlegroups.com....
On Oct 30, 3:17 pm, "Aaron Gray" <ang.use...@gmail.comwrote:
I am finding that <input type="checkbox"
onchange="alert('test')"></input>
does not seem to work properly on IE7.
Use the click event with checkboxes. I think you will find that in
some browsers the change event fires only after the input loses focus..
Okay great 'onclick' works but how do Iget the checkbox'es value ?
<input type="checkbox" onchange="alert('test' + this.value)"></input>
Is always giving 'on'.
Perhaps you meant onclick above?

Yes, sorry :)
Also, the checked property is likely what you are after.

Ah, got that :)
Do you really care about the value?

No.

Thanks alot David,
No problem. One caveat though. It seems to me that there is at least
one old version of Mac IE that will not work as expected. My memory
is fuzzy on this though. I remember consulting on a project a few
years ago that did something like this:

function mycheckboxclick() {
if (isMacIE) {
someglobalflag = this.checked;
} else {
someglobalflag = !this.checked;
}
}

This is madness of course (first thing I did was change the global
flag to a function that returned the present value of the checked
property.) The "reasoning" for the above logic was that a unit test
failed in Mac IE and this hack "fixed" it. This is the same brain-
dead methodology used by Prototype, jQuery, etc. You can probably
imagine my ultimate recommendation (throw the bums out.)
Oct 30 '08 #8

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

Similar topics

2
by: miarte | last post by:
I would like to preview an image before uploading. This code works fin on IE but not on Netscape. Does anyone know a work around for this one. Code ------------------- <script...
6
by: Dennis Allen | last post by:
Hi. I got a checkbox in a form. When the form is submitted, an email is generated. In the email text is the field name: on or off. The client doesn't want to see on or off, but yes or no. ...
2
by: johnp | last post by:
Hi, Our Tech department updated users to Office 2003 this week. Now the input mask in one of the applications is showing up as: (###) ###-### The input mask wizard works correctly when I...
1
by: theresa | last post by:
I'm about at my wits end trying to figure out why this isn't working, so I'm hoping one of you can help! I'm sure there must be something simple I'm missing. I have a checkbox on an Asp.NET 2.0...
18
by: bning | last post by:
Hmm this forum really doesn't give you long enough to type in your question before logging you out.. well here goes my second attempt: I'm trying to teach myself javascript with dom scripting and...
2
by: brian.gaber | last post by:
I have a table inside a form and each row of the table has a similar <SELECT ... statement, only the name and id is different. Here is one example: <select name="status11"...
4
by: Aaron Gray | last post by:
The following input checkbox onclick via DOM is not working on IE7, FF, or WebKit, but is working on Opera for some strange reason. http://www.aarongray.org/Test/JavaScript/checkbox.html ...
0
by: sydneycan | last post by:
Hi everyone. First time I'm posting something, so far I've been able to google it out but this time no luck so far... I have a html input checkbox on my page From the javascript 'switchlayers' in...
1
by: deepakraikar | last post by:
i have done a working code of visiblity of checkboxes depending upon the drop dwon selection.......it works fine with mozilla but its not working with the internet explorer...... my javascript...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.