Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2003
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts

    basic parsing url into array

    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

  • #2
    Regular Coder
    Join Date
    Mar 2003
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I found:
    http://www.codingforums.com/showthre...ing+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????

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    document.write (+ arg[1])

    Remove the item highlighted in red above and try it.
    Check out the Forum Search. It's the short path to getting great results from this forum.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •