Topics:
DVR
nvrec
Mplayer
Links
Misc
Commands
Humor
New user
uploaded files
|
(links)-> (Parent)->Get url query paramaters in javascript |
submited by Russell Thu 19 Apr 12 |
I played with this a bit to get it to work, here is what I settled on :
var ARG=new Array();
var query="";
URL = window.location.toString();
var x=URL.search(/?/);
if (x>1) // if some paramaters
{ query=URL.substring(x+1,URL.length); };
var queryList = query.split("&");
for (var i=0; i<queryList.length; i++) {
var element = queryList[i].split("=");
ARG[element[0]]=element[1];
document.write(element[0] +" ="+ unescape(element[1]) + " ");
};
page=ARG['page'];
Comment out the "document.write" line to hide the output.
Read values by reading the array as in the last line page=ARG['page']
This code is very losely based on code I found here:
|
Add comment or question...:
|