What's The Problem?
Only in Internet Explorer (surprise) is my code executed incorrectly. The short crap of code below should append an "onclick" action to each "a" tag. This works wonderfully but look at the fifth line, it should set the second function argument to the value of the "href" attribute of the anchor tag. In WebKit, Mozilla etc. it's fine. If we set "href" to say "lorem_ipsum" then WebKit, Mozilla etc. retrieve the correct result and set the second function argument to "lorem_ipsum", Internet Explorer prefixes "http://www.some.site/" so we see "http://www.some.site/lorem_ipsum" reported as the second argument. Internet Explorer is incorrect as that is not the "href" attribute of the anchor tag's actual value.
Anchors=Parent.getElementsByTagName("a");
Anchor=0;
while(Anchor<Anchors.length){
Anchors[Anchor].onclick=function(){
Plot("",this.getAttribute("href"));
return false;
};
Anchor++;
};
How can I get around this absurd problem? Would I need to strip away from the string everything before the final slash? That seems a long winded approach! Any Ideas?