472,807 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,807 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 22908
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.