

ID: 524
Viewed: 3887
Added: Jan 24, 2004
Version: 1.0



Snippet uploaded by: agent002
Written By: agent002
Demo: Sorry, no demo



Thank you for your vote. Please wait...
It appears you already voted for this snippet
It appears your vote value was empty


A function for getting data from the query string.
<!---Head--->
<script type="text/javascript"><!--
// Query string is:
// firstname=John&lastname=Doe
// Get value for 'firstname':
// var firstname = GetQuery('firstname');
// (The script automatically unescapes the value).
function GetQuery(arg){
var query = location.href.substring((location.href.indexOf('?') + 1), location.href.indexOf('#'));
if(location.href.indexOf('#') < location.href.indexOf('?')){
query = location.href.substring((location.href.indexOf('?') + 1), location.href.length);
}
if(location.href.indexOf('?') < 0){
query = '';
}
var querypairs = query.split('&');
var ret = '';
for(var i = 0; i < querypairs.length; i++){
var namevalue = querypairs[i].split('=');
if(namevalue[0] && namevalue[1] && namevalue[0] == arg){
while(namevalue[1].indexOf('+') >= 0){
namevalue[1] = namevalue[1].replace('+', ' ');
}
ret = unescape(namevalue[1]);
}
}
return ret;
}
--></script>
<!---Body--->
haha
No Comments to show


Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.