User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,516 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,728 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 4248 | Replies: 2
Reply
Join Date: Aug 2007
Posts: 57
Reputation: rrocket is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
rrocket's Avatar
rrocket rrocket is offline Offline
Junior Poster in Training

Help Checkbox has no properties in FireFox. Works fine in IE

  #1  
Aug 24th, 2007
What can I do not get this to work in Firefox?
document.getElementById("type_" + x).checked

When I used
alert(document.getElementById("type_" + x).checked);
to check the value it comes up fine in IE, but I get a "has no properties" error in FireFox.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2007
Posts: 2,537
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 110
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: Checkbox has no properties in FireFox. Works fine in IE

  #2  
Aug 25th, 2007
There are several possibilities, but I need to see more to tell what. The possibilities:

1. IE is not case sensitive for styles and tags. Firefox is case-sensitive. So, to be sure your ids and styles are compatible, make everything in your stylesheet and references lowercase.

2. It may depend on the browser whether it is looking for the name attribute or the id attribute. For Input boxes, it is best to provide both. But remember that all radio buttons in a group require the same name, but different ids.

3. Check for accidental capitalizations and typos.

4. Do you accidentally have two objects with the same id attribute? Do you have a different object with a name attribute which is the same as the id attribute you are using?

5. Remember that the checked attribute is boolean.

6. Are the contents of the variable x known to be a string? If not, are they known to be an integer? You may have an issue with roundoff error if the value is calculated.

7. Did you return x from a function? If so, it may be that you used a parameter passing method that returns a value on one browser, but not on another.

8. How did you declare x? It may be that, under the rules of one browser, x is outside its scope.

9. Could x have a leading blank for some reason?

10. I was told to use single quites for JavaScript strings, and double quotes for html attributes. I don't think this is a hard rule, but it might be confusing something.

Try doing this:

strig = 'type_' + x;
alert(strig);
alert(document.getElementById(strig).checked);

Look at strig and see what it really is.
Last edited by MidiMagic : Aug 25th, 2007 at 8:04 pm.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Feb 2008
Posts: 1
Reputation: Porthos is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Porthos Porthos is offline Offline
Newbie Poster

Re: Checkbox has no properties in FireFox. Works fine in IE

  #3  
Feb 22nd, 2008
Midi magic ! you are a G-D!!
thanks for the tip
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 6:22 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC