Forum Moderators: open

Message Too Old, No Replies

replace method iteration

         

webaster

6:22 pm on Mar 12, 2005 (gmt 0)

10+ Year Member



I want to achieve that when iterating all anchor tags of gallery
that when I click on link 1 the replacer function will replace the location with link.html#1, when I click on link 2 the replacer function will replace the location with link.html#2, when I click on link 3 the replacer function will replace the location with link.html#3 and further

function Iterator()
{
var galleryLinks; // use local var
if(document.getElementById) // thus getElementsByTagName support assumed
galleryLinks = document.getElementById('gallery').getElementsByTagName('a');
else if(document.all)
galleryLinks = document.all.gallery.all.tags('a');
else return // reject NS4 etc
for (var i=0;i<galleryLinks.length;i++)
galleryLinks[i].onclick = replacer;

}

webaster

6:22 pm on Mar 12, 2005 (gmt 0)

10+ Year Member



also notice the hash - #1,#2. #3