- First get the url parameters from the document.location object as follows:
- Code: Select all
var Params = document.location.search.substring(1);
- Now you can parse the parameters using the .split() function as follows:
- Code: Select all
Params = Params.split('&');
- Now you have all the url parameters in the form of key=value pair in the "Params" array.
- You can further process this array as per your needs.
The complete code is as follows:
- Code: Select all
var Params = document.location.search.substring(1);
Params = Params.split('&');
var Count = Params.length;
var Parameters = array( );
for (i = 0; i < Count; i ++)
{
var Temp = Param[i].split("=");
Parameters[i] = array(2);
Parameters[i][0] = Temp[0]; // Key
Parameters[i][1] = Temp[1]; // Value
}
- Now you can enjoy your erest of the work with the "Parameters" array.