getURLParameters = function(url){
var results = {};
if(url == ""){
var url = window.document.URL.toString();
}
if (url.indexOf("?") > 0){
var splitURL = url.split("?");
params = splitURL[1].split("&");
for (var i=0;ivar param = params[i].split("=");
if (param[1] != "")
results[param[0]] = unescape(param[1]);
else
results[param[0]] = "";
}
}
return results;
};
getURL = function(url){
if(url == ""){
var url = window.document.URL.toString();
}
if(url.indexOf("?") > 0){
var splitURL = url.split("?");
url = splitURL[0];
}
return url;
};
getURL() actually serves two purposes. If a url isn't passed in get the current url. And it also cleans off all of params so all you get the base url.

0 comments:
Post a Comment