getElementByID problems in Firefox

B

Bob

I'm trying set the initial value for a drop-down manu box to the
current date

iMonth = dCurDate.getMonth()+1;
document.getElementById('tbMonth').value = iMonth;
alert (iMonth);

This works correctly in IE but not in Firefox. It prints out "10" in IE
but doesn't get that far in FF.

Anyone know the solution?
 
L

Lee

Bob said:
I'm trying set the initial value for a drop-down manu box to the
current date

iMonth = dCurDate.getMonth()+1;
document.getElementById('tbMonth').value = iMonth;
alert (iMonth);

This works correctly in IE but not in Firefox. It prints out "10" in IE
but doesn't get that far in FF.

Anyone know the solution?

With only that amount of information to work with, we can only guess.
My guess is that you don't have an element with an id value of "tbMonth".
Note that "id" is not the same as "name", although some particularly
badly designed software may allow you to treat a name as if it were an
id.


--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,274
Latest member
JessMcMast

Latest Threads

Top