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

document.forms[0].elements[7].value won't work

P: n/a
Why doesn't this work - no errors, just no value when text is in textbox

var fn=document.forms[0].elements[7].value;

Thanks

Tom

Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
uNConVeNtiOnAL wrote:
Why doesn't this work - no errors, just no value when text is in textbox

var fn=document.forms[0].elements[7].value;


Define "doesnt work" and what browser?
Jul 23 '05 #2

P: n/a
uNConVeNtiOnAL wrote:
Why doesn't this work - no errors, just no value when text is in textbox

var fn=document.forms[0].elements[7].value;


<data> I do not have enough information to make a hypothesis. </data>
PointedEars
Jul 23 '05 #3

P: n/a
Lee
uNConVeNtiOnAL said:

Why doesn't this work - no errors, just no value when text is in textbox

var fn=document.forms[0].elements[7].value;


You haven't shown us enough information.
That line will work, if there is a value in a textbox
which is found at document.forms[0].elements[7].value

One common error would be to confuse elements[7] with
the seventh element. It is actually the eighth.

This demonstrates only one of many reason why it's
usually better to identify elements by name or id,
rather than number.

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.