21 lines
No EOL
607 B
JavaScript
21 lines
No EOL
607 B
JavaScript
window.getParameterByName = function(name) {
|
|
url = window.location.href;
|
|
name = name.replace(/[\[\]]/g, "\\$&");
|
|
|
|
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
|
|
results = regex.exec(url);
|
|
|
|
if (!results) return null;
|
|
if (!results[2]) return '';
|
|
|
|
return decodeURIComponent(results[2].replace(/\+/g, ' '));
|
|
}
|
|
|
|
window.getCookie = function(name) {
|
|
match = document.cookie.match(new RegExp(name + '=([^;]+)'));
|
|
if (match) return match[1];
|
|
}
|
|
|
|
window.deleteCookie = function(name) {
|
|
document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
|
|
} |