dzLib.js
 

getParameter-object (querystring)

Description:
Easy client-side access to the querystring. The querystring is exposed as an object.

Download: code, view-source.
Targetted: all
Tested on: win32: ie6, OS X: ie5.1

Usage

 
//Access the querystring
var oQS=new getParameter();
if(oQS.strName!=null)
{
	alert('Supplied name is '+oQS.strName);
}

//Create a GET request without a form (and automatic escaping)
var oQS=new getParameter();
oQS.clearAll();
oQS.strName='Your Name';
oQS.strEmail='your.name@domain.com';
document.writeln(oQS.toString());
  

Live Demo

current QueryString

Want an QS-example: name and email. There's also a pretty long one.

 
//The Demo Code
var oQS=new getParameter(), bln=false;
for(var i in oQS)
{
	if(typeof oQS[i]=='string') 
	{
		document.writeln(''+i+': '+oQS[i]+'
'); bln=true; } } if(!bln) { document.writeln('There\'s no querystring parameter supplied with URL'); }