By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,089 Members | 2,301 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,089 IT Pros & Developers. It's quick & easy.

firefox problem with accessing form value

P: n/a
Does anyone know why i can't access a form element value using dot
notation in firefox, when i'm in a function. Works ok in the body.
I'm trying to do this:

var FarTemp = faren.temp.value;

I can get at the value using the array method, the getelements by id
method, and the bracket-with-the-element-name in it method. But the
dot notation doesn't work, in firefox, in the function (which i have
in the head).

Thanks for any help.

Mar 4 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
ju***********@cox.net wrote :
Does anyone know why i can't access a form element value using dot
notation in firefox, when i'm in a function. Works ok in the body.
I'm trying to do this:

var FarTemp = faren.temp.value;
This is a typical error in accessing form values. Please visit

Using Web Standards in your Web Pages
Section 3.2: Accessing Elements with the W3C DOM
http://developer.mozilla.org/en/docs...your_Web_Pages

Also:

Referencing Forms and Form Controls by comp.lang.javascript newsgroup
FAQ notes
<http://jibbering.com/faq/faq_notes/form_access.html>

DOM 2 specification on accessing forms and form elements
<http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-40002357>

Javascript Best Practices: Referencing Forms and Form elements
correctly, by Matt Kruse
<http://www.javascripttoolbox.com/bestpractices/#forms>

Making your web page compatible with Mozilla from Nicolás Lichtmaier
<http://www.reloco.com.ar/mozilla/compat.html>
I can get at the value using the array method, the getelements by id
method, and the bracket-with-the-element-name in it method. But the
dot notation doesn't work, in firefox, in the function (which i have
in the head).

Thanks for any help.

var FarTemp = document.forms["faren"].temp.value;
or
var FarTemp = document.forms["faren"].elements["temp"].value;

FormName.InputName.value
can be replaced with
document.forms["FormName"].InputName.value
or
document.forms["FormName"].elements["InputName"].value

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
Mar 5 '07 #2

P: n/a
Lee
ju***********@cox.net said:
>
Does anyone know why i can't access a form element value using dot
notation in firefox, when i'm in a function. Works ok in the body.
I'm trying to do this:

var FarTemp = faren.temp.value;

I can get at the value using the array method, the getelements by id
method, and the bracket-with-the-element-name in it method. But the
dot notation doesn't work, in firefox, in the function (which i have
in the head).
That's not a valid reference to a form value, although some sloppy
browsers allow it:

var FarTemp = document.faren.temp.value;

is probably what you're looking for.
--

Mar 5 '07 #3

P: n/a
Mr. Talbot, Thank you very much.
On Mar 4, 7:46 pm, Gérard Talbot <newsblahgr...@gtalbot.orgwrote:
judy.j.mil...@cox.net wrote :
Does anyone know why i can't access a form element value using dot
notation in firefox, when i'm in a function. Works ok in the body.
I'm trying to do this:
var FarTemp = faren.temp.value;

This is a typical error in accessing form values. Please visit

Using Web Standards in your Web Pages
Section 3.2: Accessing Elements with the W3C DOMhttp://developer.mozilla.org/en/docs/Using_Web_Standards_in_your_Web_...

Also:

Referencing Forms and Form Controls by comp.lang.javascript newsgroup
FAQ notes
<http://jibbering.com/faq/faq_notes/form_access.html>

DOM 2 specification on accessing forms and form elements
<http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-40002357>

Javascript Best Practices: Referencing Forms and Form elements
correctly, by Matt Kruse
<http://www.javascripttoolbox.com/bestpractices/#forms>

Making your web page compatible with Mozilla from Nicolás Lichtmaier
<http://www.reloco.com.ar/mozilla/compat.html>
I can get at the value using the array method, the getelements by id
method, and the bracket-with-the-element-name in it method. But the
dot notation doesn't work, in firefox, in the function (which i have
in the head).
Thanks for any help.

var FarTemp = document.forms["faren"].temp.value;
or
var FarTemp = document.forms["faren"].elements["temp"].value;

FormName.InputName.value
can be replaced with
document.forms["FormName"].InputName.value
or
document.forms["FormName"].elements["InputName"].value

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)http://developer..mozilla.org/en/doc...s_in_your_Web_...

Mar 5 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.