473,480 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

getElementByID problems in Firefox

Bob
This works fine in IE6.

monDoc = document.getElementById('tbMonth');
mon = monDoc.value;

But Firefox doesn't recognize the value property. What works in FF?

Oct 21 '06 #1
3 4927
Bob said the following on 10/21/2006 3:08 PM:
This works fine in IE6.
Probably because IE doesn't know the difference between a NAME attribute
and an ID attribute.
monDoc = document.getElementById('tbMonth');
mon = monDoc.value;

But Firefox doesn't recognize the value property. What works in FF?
Without seeing your HTML, that is impossible to answer.

You probably have an input with a name attribute of "tbMonth". If so,
use the form collection to access it:

document.forms['formIDnotName'].elements['elementNAMEnotID'].value;

Or, change your attribute from name to ID, or use both.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 21 '06 #2
Bob

Randy Webb wrote:
Bob said the following on 10/21/2006 3:08 PM:
This works fine in IE6.

Probably because IE doesn't know the difference between a NAME attribute
and an ID attribute.
monDoc = document.getElementById('tbMonth');
mon = monDoc.value;

But Firefox doesn't recognize the value property. What works in FF?

Without seeing your HTML, that is impossible to answer.

You probably have an input with a name attribute of "tbMonth". If so,
use the form collection to access it:

document.forms['formIDnotName'].elements['elementNAMEnotID'].value;

Or, change your attribute from name to ID, or use both.
Thanks Randy, I added the id attribute so it has both name and id, and
all works fine.

Oct 21 '06 #3
Bob

Randy Webb wrote:
Bob said the following on 10/21/2006 3:08 PM:
This works fine in IE6.

Probably because IE doesn't know the difference between a NAME attribute
and an ID attribute.
monDoc = document.getElementById('tbMonth');
mon = monDoc.value;

But Firefox doesn't recognize the value property. What works in FF?

Without seeing your HTML, that is impossible to answer.

You probably have an input with a name attribute of "tbMonth". If so,
use the form collection to access it:

document.forms['formIDnotName'].elements['elementNAMEnotID'].value;

Or, change your attribute from name to ID, or use both.
Thanks Randy, I added the id attribute so it has both name and id, and
all works fine.

Oct 21 '06 #4

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

Similar topics

3
9237
by: davidkarlsson74 | last post by:
Error: document.getElementById("folderMenu").cells has no properties File: http://www.volkswagen.se/tillbehor/js/foldermenu.js Rad: 49 The function activates different DIV:s, but doesn't seem to...
5
4287
by: Andrea | last post by:
I am trying to alter css using javascript as well as use the innerHTML function. I have pasted below 3 forms that access getElementById in slightly different ways (I wanted to rule out that it was...
4
2635
by: the other john | last post by:
I came across a third party script I want to learn how to configure as well as learn more dhtml in the doing. I'm not much of a JS guy yet but I'm working on it. This script works fine in IE6...
5
77530
by: antonyliu2002 | last post by:
Hi, It looks like so many people are having problems with the javascript submit in firefox. I searched around, but haven't found a solution yet. Mostly, people were saying, try this or try...
13
4911
by: RommelTJ | last post by:
Hi, My website (http://www.justiceinmexico.org/indextest.php) looks good in Firefox, but horrible in IE, and I think it's because of an error in the javascript of a free web ticker I got off the...
29
19133
by: Nick | last post by:
I've seen a few frameworks use the following: function $(id) { return document.getElementById(id); } Then to use: $('something').innerHTML = 'blah'; I'm just trying to roll this out to my...
8
3123
by: cyqotiq | last post by:
First, let me state that this is not necessarily a Firefox problem, as I haven't fully tested in IE just yet. Second, let me state that this is not the typical "getElementById not working Firefox"...
3
2045
by: GarryJones | last post by:
The following works in MSIE but not firefox. I suspect it has something to do with the fact that the element I am trying to access is not the "tid" which is the name of the DIV that is passed to...
1
2212
by: vikD | last post by:
Hello, I'm really bad at javascript but I managed to get the code below to work in IE but firefox gives this error... Error: document.getElementById.formall is undefined Basically use the...
0
7048
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,...
1
6743
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4787
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2999
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.