Query string cleanup and move it to util.js

This commit is contained in:
Joel Martin
2010-07-22 11:33:21 -05:00
parent a7a8962676
commit a8edf9d8a5
3 changed files with 21 additions and 18 deletions
+9
View File
@@ -160,6 +160,14 @@ Util.dirObj = function (obj, depth, parent) {
return msg;
};
// Read a query string variable
Util.getQueryVar = function(name, defVal) {
var re = new RegExp('[?][^#]*' + name + '=([^&#]*)');
if (typeof defVal === 'undefined') { defVal = null; }
return (document.location.href.match(re) || ['',defVal])[1];
};
/*
* Cross-browser routines
*/
@@ -264,6 +272,7 @@ Util.Flash = (function(){
/*
* Cookie handling. Dervied from: http://www.quirksmode.org/js/cookies.html
*/
// No days means only for this browser session
Util.createCookie = function(name,value,days) {
var date, expires;