SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2002
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Drop Down list and redirection HELP!!

    I have a drop down list which contains 5 cities like NY, Paris....

    When the user selects a city and press Go button i want the user to be redirected to the url of the city he selected.

    That's my problem. Any help?

    Thanks in advance!

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    If your pages are named after the city, then you can try this:

    HTML example:
    Code:
    <select name="cities" onchange="goToCity(this, this.selectedIndex);">
    <option value="Sydney">Sydney</option>
    <option value="Miami">Miami</option>
    <option value="London">London</option>
    <option value="Seoul">Seoul</option>
    <option value="Tokyo">Tokyo</option>
    </select>
    Javascript:
    Code:
    function goToCity(sel, num) {
     window.location.href = sel.options[num].value + ".html";
    }
    Hope this helps!

  3. #3
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Vinnie Garcia
    Developer
    (I need a better sig!)
    How about this?

    101011011010011101110110111011010011100101100000100011111000011110010110001111010011100001
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





Bookmarks

Posting Permissions

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