[thelist] Form sniffing within tables nested within divs

Roger Ly rogerly at bareviking.com
Wed Nov 6 13:51:01 CST 2002


Hey Chris,

What about something like this:

function doIndividualFormStuff(formObject) {
	alert(formObject.name);
}

function doFormsStuff(divID) {
	for (i = 0; i < document.all[divID].all.length; i++)
	{
		var object = document.all[divID].all[i];
		if (object.elements)
		{
			// if object.elements exists, it is a form
object
			doIndividualFormStuff(object);
		}
	}
}

since elements is only a property of a form object, checking the
existence of that property is a quick and dirty way of determining if
you are dealing with a form element.  Also, since you are only iterating
through the objects of a particular div (as referenced by
document.all[divID]), it should only return form objects in that div.

If you want to get all the form objects in the divs within the divs, I'm
sure you can alter the code to traverse the children of the top-most
div.

Roger


-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org] On Behalf Of Feingold Josh S
Sent: Wednesday, November 06, 2002 11:20 AM
To: 'thelist at lists.evolt.org'
Subject: RE: [thelist] Form sniffing within tables nested within divs

--
[ Picked text/plain from multipart/alternative ]
> What I don't know how to do is to use the DOM (or any other means) of
> identifying if a form is lower in the DOM and included in the nesting
of
> a given element.

Chris -

Well now I understand your question better, but have no ready solution.
Hopefully others following the thread might have something more.

Sorry.

Josh
--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !




More information about the thelist mailing list