URL variables are variables that are passed in as part of the address(URL)of a page. Typically they are a series of name-value pairs that are separated by an ampersand and are delineated from the page's URL by a question mark.
var searchString = document.location.search;
// strip off the leading '?'
searchString = searchString.substring(1);
var nvPairs = searchString.split("&");
for (i = 0; i < nvPairs.length; i++)
var nvPair = nvPairs[i].split("=");
var name = nvPair;
var value = nvPair;
First we strip off the questionmark separating the URL of the page from its parameter list. Then we create an array of all the name-value pairs. Lastly, we loop through this array and extract each name and value. (You would insert conditional logic to handle these name-value pairs at that point).