Hello again. Looking for help. I want to get all links in div. For example: <div id="div4search"> <p>text here...</p> <a href='#1'>link1</a> <span>text...</span> <a href='#2'>link2</a> <strong>text...text...text...</strong> <a href='#3'>link3</a> </div> Code (markup): how to collect all objects in array with tag A inside this DIV where id="div4search"? getEmelentsByTagName("A") will collect all links on the page. I need links that placed only inside the div. Thanks a lot.
<script type="text/javascript"> var div = document.getElementById("div4search"); var i; for (i=0;i<div.childNodes.length;i++) { alert(div.childNodes[i]); } </script> HTML: I hope it's clear enough
taken from http://www.thescripts.com/forum/thread167283.html var someas = div4search.getElementsByTagName('a');
thanks, guys. I wnated to find out the simplest way. div4search.getElementsByTagName('a') Code (markup): is that what i needed.