getElementById errors

G

Greg

I'm trying to understand getElementByID a bit better.

When I try the following...

if (parseFloat(document.getElementByID('QuantityMade').value) > 0) {
alert('it seems to exist');
}

(the text field QuantityMade holds a value of 17)

I get an error saying the Object doesn't support this property or method.

so I pare it down to this...

if (document.getElementByID('QuantityMade').value > 0) {
alert('it seems to exist');
}

and get the same error

So I try this...

alert(document.getElementByID('QuantityMade').value);

and get the same error

is this not a valid way to get the value of a text field when only its
ID is known?? Is there a better strategy for getting and setting this
value from anywhere in a page???

Thanks.
 
G

Greg

WOW I feel like such a fool.

Thanks Chris, I really needed that. (And of course it works fine now :) )

Greg.
 

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,278
Latest member
BuzzDefenderpro

Latest Threads

Top