A troubling little piece of JS:
Code:
function querySt(ji) {
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i = 0; i < gy.length; i++) {
ft = gy[i].split("=");
if (ft[0] == ji) {
return ft[1];
}
}
}
var doc = querySt("doc")
if (doc == "ND_AR") {
pageTracker._trackPageview('/downloads/1');
window.location = "http://www.mysite.com/pdf1.pdf";
}
else if (doc == "ND_ZH") {
pageTracker._trackPageview('/downloads/2');
window.location = "http://www.mysite.com/pdf2.pdf";
}
else if (doc == "ND_FR") {
pageTracker._trackPageview('/downloads/3');
window.location = "http://www.mysite.com/pdf3.pdf";
}
else if (doc == "ND_DE") {
pageTracker._trackPageview('/downloads/4');
window.location = "http://www.mysite.com/pdf4.pdf";
}
When hitting any one of these urls (eg: www.mysite.com/redirect.htm?doc=ND_AR) the script never gets to the redirect. If I put the redirect before the statement the redirect works but I assume the does not. Any ideas why the is causing problems?
Thanks
Bookmarks