Javascript get url parameters.

In this article, I will explain  how to get url parameters in javascript.We are using following JavaScript code to get url parameters using javascript.I have written simple javascript function which will get a URL parameter and return it to you.
Suppose,My URL is and i want to
get parameters a=1,b=2
please check following code to Retrieve URL GET parameters with Javascript.
Example:getting URL parameters using Javascript
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>getting URL parameters using Javascript</title>
<script language="javascript">  
 function getParameters() 
   var url = window.location.href;//get an url
   var splitUrl = url.split("?");
   var splitparam = splitUrl[1].split("&");
   var arrname = new Array();
   var arrvalue = new Array();
   var i = 0;
   for (i=0;i<splitparam.length;i++){
       var Param =  splitparam[i].split("=");
       arrname[i] = Param[0];
       arrvalue[i] = unescape(Param[1]);
for (i=0;i<splitparam.length;i++)
  alert(arrname[i]+" = "+ arrvalue[i]);//get url parameters

You can now get the current url parameters using the above code.I hope,this example will help you to get url parameters using JavaScript.