[Javascript] Need to loop through all element in a div cross browser

Laurent Muchacho LaurentM at london.virgin.net
Thu Dec 9 09:49:27 CST 2004


Hi All,

Guy's I seriously need your help.
What I'm trying to do is a loop through all element first level nested
contained in a DIV.
The Idea is to reproduce the document.all implemented by IE but cross
browser.
Please if you think it's impossible please reply and let me know.

Found below an examples of my html

<div id="parentDiv">
	<input type="text" name="test1" value="">
	<input type="text" name="test2" value="">
	<input type="text" name="test3" value="">
	<input type="text" name="test4" value="">
	<input type="text" name="test5" value="">
	<select name="select1">
		<option>test 1</option>
		<option>test 1</option>
		<option>test 1</option>
		<option>test 1</option>
	</select>
	<div id="childDiv1">
		don't want to count the item nested in this element
		<input type="text" name="childDiv1test1" value="">
	</div>
	<div id="childDiv2">
		don't want to count the item nested in this element
		<input type="text" name="childDiv2test1" value="">
	</div>
</div>

Thanks in advance.

Laurent



More information about the Javascript mailing list