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

Find the right object form

P: n/a
Hello,
for a long while I was trying to detective why I had always the same
problem with an object mistake in my source code.
function countBoxes( form )
{
....
elems = document.forms[form].elements;<-- there is no object and I do
not know what is the right syntax (changing these forms were
unsucessfull)
for ( i = 0; i < elems.length; ++i ) {
....}
}

P.S. By checking any forms do I need using boolean or is it not so
simpel?
Many thanks for answering
B.Jackschina
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ja*******@hotmail.com (Bjoern Jackschina) writes:
for a long while I was trying to detective why I had always the same
problem with an object mistake in my source code. function countBoxes( form )
{
...
elems = document.forms[form].elements;<-- there is no object and I do
not know what is the right syntax (changing these forms were
unsucessfull)
The syntax is correct. I recommend putting "var" in front of elems,
so the variabel scope is only the function body. Otherwise it becomes
a global variable and lives forever.

For this correct syntax to work as you expect, the variable "form" must
contain either the id of the form or its index in the forms collection.
We can't know that without seeing how you call the function.
P.S. By checking any forms do I need using boolean or is it not so
simpel?


What? More detail please! What are you trying to do?

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.