I realize this is a 2-year old thread, but...
I'd very much like to understand how this works.
I think I could use this script to apply an onclick that swaps images... but I'm not sure how to go about doing so.
I have something like this: (I realize I could be way off on the intercept part)
function addClick(){
for (i=0;i<document.links.length;i++){
var hHref=document.links[i].getAttribute("href")
var lTxt=document.links[i].innerHTML;
document.links[i].setAttribute("onclick","intercept('"+hHref+"','"+lTxt+"')");
document.links[i].setAttribute("href","javascript:intercept('"+hHref+"','"+lTxt+"')");
}
}
function intercept(hRef,lTxt){
getElementsByClassName(document, "a", "artist").value=hRef+'\r'+lTxt;
}
Anyone care to help? 😃