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

Fix for using EVAL command in JS

P: 2
I have js that works ok in IE but Firefox returns the error message "Document.forms is not a function" on ht eline that begins with the "For" operator.

Ya, I'm a real nube.. is it obvious?

Expand|Select|Wrap|Line Numbers
  1. fms='document.forms(tempFormName)'
  2. for (i=0; i<eval(fms+'.length'); i++)
Thanks in advance!!
Jun 9 '11 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 5K+
P: 8,639
that’s correct, there is no forms() method in the document object (that is JScript only). but why should you have more than one form with the same name?

in standard DOM you access forms by:
Expand|Select|Wrap|Line Numbers
  1. // by index number (in document order)
  2. document.forms[form_number]
  3. // by known name
  4. document.form_name
  5. // by unknown name
  6. document[form_name]
Jun 10 '11 #2

P: 2
Hi Dormilich,
Thanks for responding so quickly. I was given a task to take a look at some web pages and I find myself asking the same question you did. "Why". I think I may just pass this project onto someone more experienced.

Thank you
Jun 10 '11 #3

P: 8
Hey, strange example, first rule: eval is evil :).
Jun 22 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.