bon733
Posts: 25
|
| Posted: 09/01/2005, 9:03 PM |
|
I am trying to get the value of two fields in a table stored in a database to use in a javascript. How can i access these fields in a clean and easy way? I tried putting the fields on the form as hidden and then referencing them using the document.forms[0].... but I keep getting an error stating that the object is null or not an object. ANy ideas?
|
 |
 |
DonB
|
| Posted: 09/02/2005, 8:22 AM |
|
Add id="field1" and id="field2" to the form fields (oh, by the way, these
can't be Labels, which do not exist as form fields merely as html text).
In the javascript reference them this way to get their values:
document.getElementById('field1').value
document.getElementById('field2').value
--
DonB
http://www.gotodon.com/ccbth
"bon733" <bon733@forum.codecharge> wrote in message
news:64317cf13ba175@news.codecharge.com...
> I am trying to get the value of two fields in a table stored in a database
to
> use in a javascript. How can i access these fields in a clean and easy
way? I
> tried putting the fields on the form as hidden and then referencing them
using
> the document.forms[0].... but I keep getting an error stating that the
object
> is null or not an object. ANy ideas?
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
bon733
Posts: 25
|
| Posted: 09/02/2005, 9:06 AM |
|
Thank you very much. The code worked perfectly.
|
 |
 |
DonB
|
| Posted: 09/02/2005, 1:31 PM |
|
I have found it to be much easier/reliable to locate things by ID.
--
DonB
http://www.gotodon.com/ccbth
"bon733" <bon733@forum.codecharge> wrote in message
news:64318786b81e86@news.codecharge.com...
> Thank you very much. The code worked perfectly.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |