| 6:28 pm on Jul 4, 2003 (gmt 0)|
So I have a line:
<TD><FORM NAME="elevation" action="calc.js"><input type="text" size="8"></FORM></TD>
feet = parseFloat(document.elevation.elements.value)
which gets it ready for further computations.
Moving the NAME attribute into the INPUT field did not work (i.e. the program stopped working).
Any help will obviously be much appreciated :) :)
| 6:37 pm on Jul 4, 2003 (gmt 0)|
have you tried using id instead of name?
| 6:40 pm on Jul 4, 2003 (gmt 0)|
Thanks for the quick answer!
Alas, wth id (in either form or input) it does not work.
| 6:47 pm on Jul 4, 2003 (gmt 0)|
probably because of the method of access in the js, getelementbyid or all?
| 6:59 pm on Jul 4, 2003 (gmt 0)|
> probably because of the method of access in the js, getelementbyid or all?
My js file simply starts with a function that uses parseFloat to get numeric values.
| 7:05 pm on Jul 4, 2003 (gmt 0)|
Just skip the name attribute...
Use document.forms... where the number is the form number. (First form = 0, second form = 1, etc.)
getElementById works in DOM compliant browsers... But, if you want the script to work in older browsers, particularly NN4, you need to use the forms array (forms)
| 7:09 pm on Jul 4, 2003 (gmt 0)|
The W3C section 17.3 The FORM element [w3.org] does list name as an attribute of form:
|This attribute names the element so that it may be referred to from style sheets or scripts. Note. This attribute has been included for backwards compatibility. Applications should use the id attribute to identify elements. |
but their validator, with a transitional DOCTYPE, tells me:
|Line 24, column 11: there is no attribute "NAME" (explain...). |
| 7:16 pm on Jul 4, 2003 (gmt 0)|
It works and it validates!
Problem posted at 2:28 PM EDT.
Problem solved at 3:05 PM EDT.
<edit>I note that my numerous exuberant exclamation marks have been reduced to one per occurrence.</edit>