View Full Version : Get URL Parameters Using Javascript

05-04-2008, 05:20 AM
So what I need to do is pretty much say

"If &type=1 is at the end of document.URL than do this function .. if &type=1 ISNT in the URL ... than do something else" (kinda like if/else)

Philip M
05-04-2008, 11:57 AM
var theURL = window.location; // or var theUrl = document.URL;
if (/(&type=1)$/i.test(theURL)) { // returns true if ends in &type=1
else {

"I cannot conceive that anybody will require multiplications at the rate of 40,000 or even 4,000 per hour ..." -- F. H. Wales (1936)