If you would like this for only one page, put the following inside the <head> tag.
Code:
<script type="text/javascript">
function functionname() {
if(document.getElementById) {
var anchorTags = document.getElementByTagName("a");
for(var lcount=0; lcount<anchorTags.length; lcount++)
{
/* do something with each individual anchor tag */
/* anchorTags[lcount] represents the current anchor tag within the loop */
}
}
}
</script>
if you would like this for more then one page, create an external javascript (js) file and link to the script on each page using the following code
Code:
<script type="text/javascript" href="path/to/script">
</script>
to access the script itself use the following code located where ever you wished to use the script
Code:
<a href="javascript:functionname()">Get all links on this page</a>
Bookmarks