Forum Moderators: open
window.location.replace( 'page.html'+document.location= .hash ) ;
}
}}
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;
}
Is it possible to extract the href and then use location.replace
The Code
<ul id="gallery">
<li><a href="page.html#1"></a><li>
<li><a href="page.html#2"></a><li>
<li><a href="page.html#3"></a><li>
</ul>
String.replace(), which is method of the String object, allows the use of a regular expression to find and replace character patterns in a string. Since the href value is a string, you could use String.replace() to alter it, then assign the location's href, either directly or through the location.replace() method, the new value.
function replacer(){
var isIe = (navigator.appName == "Microsoft Internet Explorer");
var isOpera = (/opera/i.test(navigator.userAgent));
if(isOpera ¦¦ isIe) {
window.location.reload( 'samepage.html' ) ;
}}
Oh, and there might be some confusion; I think we may all be exspurts here, defined thusly: an ex is a has-been and a spurt is a drip under pressure.
}
}
// going back and forth from thumbs to Opera and IE workaround
function iteratorLinks()
{
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;
}
}
addEvent (window,'load',iteratorLinks)
all is correct?