function lchange() { for ( i in document.links ) { var linkBase = document.links[i].href; if(linkBase != null) { if(linkBase.indexOf("?") < 0) { document.links[i].href = document.links[i].href + document.location.search; } else { var ref = document.location.search.substring(1); document.links[i].href = document.links[i].href + "&" + ref; } } } } window.onload = lchange;