[thelist] DOM list elements only within another element

RUST Randal RRust at COVANSYS.com
Fri Jul 2 08:13:44 CDT 2004


Simon Perry wrote:

> _I want to apply some behaviors to one set of elements within my page 
> but not any others. As an example imagine the following;

> <div id="navcontainer">
> <ul>
> <li><a href="">home</a></li>
> <li><a href="">products</a></li>
> <li><a href="">help</a></li>
> </ul>
> </div>

var par=document.getElementById('navcontainer');
var kids=par.getElementsByTagName('a');

for(var i=0; i<kids.length; i++){
	//apply your behaviors here
	}

i did not test this out, but i think it's what you are looking for.

----------
Randal Rust
Covansys Corp.
Columbus, OH


More information about the thelist mailing list