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

checkbox checked property "undefined" in IE

Hello,

The following code:

function checkChildMenuItems(strNameModule)
{
alert(document.getElementById(strNameModule).check ed);
}

<input name="strMenuQA" id="strMenuQA" type="checkbox" value="1"
onclick="checkChildMenuItems(this.id);" checked="checked">

shows "true" or "false" in Firefox, when I respectively check or
uncheck the checkbox. IE however comes up with "undefined". Is this
code so exotic, that IE has problems with it??

Thanks in advance!

Frank

Oct 6 '05 #1
3 27128
bjc
Hi Frank - Just checked your code. My IE displays true / false. Here's
the page & code I used:

<html>
<head>
<meta name=vs_defaultClientScript content="JavaScript">
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<script language=javascript>
<!--
function checkChildMenuItems(strNameModule)
{
alert(document.getElementById(strNameModule).check ed);
}
//-->
</script>
</head>
<body>
<input name="strMenuQA" id="strMenuQA" type="checkbox" value="1"
onclick="checkChildMenuItems(this.id);" checked="checked">
</body>
</html>

Oct 6 '05 #2

fr***********@gmail.com wrote:

function checkChildMenuItems(strNameModule)
{
alert(document.getElementById(strNameModule).check ed);
}

<input name="strMenuQA" id="strMenuQA" type="checkbox" value="1"
onclick="checkChildMenuItems(this.id);" checked="checked">


Why do you need to pass this.id at all, why can't you simply pass this
and do
function checkChildMenuItems (element) {
alert(element.checked);
}

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 6 '05 #3
Martin Honnen schreef:
fr***********@gmail.com wrote:

function checkChildMenuItems(strNameModule)
{
alert(document.getElementById(strNameModule).check ed);
}

<input name="strMenuQA" id="strMenuQA" type="checkbox" value="1"
onclick="checkChildMenuItems(this.id);" checked="checked">


Why do you need to pass this.id at all, why can't you simply pass this
and do
function checkChildMenuItems (element) {
alert(element.checked);
}

--

Martin Honnen
http://JavaScript.FAQTs.com/

Thanks a lot for the quick reply Martin. I adapted my code, and it
works now!

Oct 6 '05 #4

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

Similar topics

13
by: Don Vaillancourt | last post by:
What's going on with Javascript. At the beginning there was the "undefined" value which represented an object which really didn't exist then came the null keyword. But yesterday I stumbled...
1
by: David R | last post by:
'lo This one is confusing me, causing 2 separate errors: Consider this XHTML and Javascript: <!-- ########################## --> <!-- SNIP --> <head> <script type="text/javascript"
25
by: Nitin Bhardwaj | last post by:
Well, i'm a relatively new into C( strictly speaking : well i'm a student and have been doing & studying C programming for the last 4 years).....and also a regular reader of "comp.lang.c" I...
1
by: Pavils Jurjans | last post by:
Hello, I am building custom hashtable class, and thinking about value retrieval issues. The thing is, that sometimes the hashtable value may contain value null. If someone is reading this value...
49
by: matty | last post by:
Hi, I recently got very confused (well that's my life) about the "undefined" value. I looked in the FAQ and didn't see anything about it. On...
9
by: Klaus Johannes Rusch | last post by:
IE7 returns "unknown" instead of "undefined" when querying the type of an unknown property of an object, for example document.write(typeof window.missingproperty); Has "unknown" been defined...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.