+ Reply to Thread
Results 1 to 2 of 2

Thread: redirect to another page when selecting an option

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    35

    redirect to another page when selecting an option

    I have options and i want when choosing an option , the user being redirected to a page.

  2. #2
    Junior Member
    Join Date
    May 2012
    Posts
    6
    Using JavaScript window.location will redirect the browser to another page, like so:
    Code:
    <script language="javascript">
    function moveTo(optionValue) {
        if(optionValue=="") return false;
        window.location='http://www.mysite.com'+optionValue;
    }
    </script>
    Than add this to your <select> box:
    Code:
    <select onchange="moveTo(this.options[this.selectedIndex].value);">
    The option value has to contain the new location address within your site. for instance:
    Code:
    <select onchange="moveTo(this.options[this.selectedIndex].value);">
        <option value="someFile.html">name</option>
    </select>

+ Reply to Thread

Tags for this Thread

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