Forum Moderators: open
I can't find anything on it. Just wanna see if anyone here can please come to the rescue!
Thanks :)
var urlArgs = cbeGetURLArguments();
var s = parseInt(urlArgs['string']);
function cbeGetURLArguments() {
var idx = location.href.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = location.href.substring(idx+1, location.href.length).split('&');
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split('=');
params[i] = nameVal[1];
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
I ended up doing this and it worked great. I have the comment code on here in case someone else desides to use it.
// Grab the querystring if there is one.
var querystring = window.location.search;
// Strip the unwanted data and grab the number.
var querystringValue = querystring.substring(querystring.indexOf("=") +1, querystring.length);
If you are grabbing a number from the querystring, add a -0 at the end or else JS is going to think it's just another normal character that has no numeric value.
// Here we have to add "-0" at the
// end of the variable so that it
// treats it as a numeric value.
var number = querystringValue-0;
Thank you all :)