...

View Full Version : basic parsing url into array



havey
07-08-2003, 04:21 PM
I have a url as such:
page.htm?age=10&edu=20&occ=14&gua=10& reg=5&tot=16&lan=12&ilt=5&ad1=5

and based on the selected options on the previous form the url may be as long as this:
page.htm?age=10&edu=20&occ=14&gua=10& reg=5&tot=16&lan=12&ilt=17&ad1=5&ad2=10&ad3=10&ad4=7

But the good news is that i only need the value pairs upto "ilt".

How could the srting be put into an array so that i could call only the value into the html, something like so:

document.write (+ dataArr[1])
document.write (+ dataArr[2])
etc....

thanks

havey
07-08-2003, 04:31 PM
I found:
http://www.codingforums.com/showthread.php?s=&threadid=7013&highlight=parsing+into+array

but i'm having problems working without the loop:
var args = parseQueryString ();
for (var arg in args) {
document.write(arg + ': ' + args[arg] + '<BR>');
}

and just with each, something like:
document.write (+ arg[1])


any ideas????

Roy Sinclair
07-08-2003, 07:38 PM
document.write (+ arg[1])

Remove the item highlighted in red above and try it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum