•
•
•
•
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
![]() |
| |
What can I do not get this to work in Firefox?
When I used to check the value it comes up fine in IE, but I get a "has no properties" error in FireFox.
document.getElementById("type_" + x).checkedWhen I used
alert(document.getElementById("type_" + x).checked); 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:
Look at strig and see what it really is.
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
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
ajax asp beta bon browser browsers browsing developer development echo email encryption europe firefox gecko home html internet internet explorer internet explorer 7 javascript leak linux memory microsoft mozilla msdn networking news office open source open-source patch phishing scams security site social software sql super testing users vista web webmail
- Previous Thread: Create a Navigation Like Apple.com
- Next Thread: JavaScript+doc+api???



Hybrid Mode