www.webdeveloper.com
Results 1 to 3 of 3

Thread: Load new page using "select onChange"

  1. #1
    Join Date
    Dec 2006
    Location
    Wolverhampton, U.K.
    Posts
    8

    Unhappy Load new page using "select onChange"

    Hi,
    I used to do bits and bobs with HTML and javascript years ago and I'm just getting back in to it and I have a problem. Why else would I post this? LOL

    I have a select menu on a html page and I want to load a new page in the same window (i.e. target="_self") dependent on the select value. I cannot for the life of me remember how to do it! Here's a rough example of how I intend to implement this...

    <select name="exampleselect">
    <option value="Please select...">Please select...</option>
    <option value="page1.html">Example1</option>
    <option value="page2.html">Example2</option>
    <option value="page3.html">Example3</option>
    </select>

    I want to use the "onChange" event to do this, but how?!?!

    Can anyone help a man with an poor, ageing memory?

    Thanks in advance....

    Chris

  2. #2
    Join Date
    Jan 2005
    Location
    Frankfort, KY, USA
    Posts
    6,167
    Code:
    <select name="exampleselect" onchange="window.location=this.value;">
    KDLA

  3. #3
    Join Date
    Dec 2006
    Location
    Wolverhampton, U.K.
    Posts
    8
    That works a treat.

    Thanks for your prompt reply.

    Merry Christmas and a happy new year to you.

    Chris

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles