SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <select> works in FF not in IE

    Why is this not working in IE? By not working I mean it doesn't go to selected url.

    Code:
    <select>
      <option>
    -------- View More Poems --------
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poems/dark-day")'>
    &lt;-- Previous Poems
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poems/one-year")'>
    One Year
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poems/the-conversation")'>
    The Conversation...
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poems/thats-okay")'>
    That's Okay
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poems/the-riddle")'>
    The Riddle
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poems/swim")'>
    They're Swimming
      </option>
    </select>

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,826
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The following is a corrected copy of your code that gets rid of all of the () that shouldn't be there.

    Code:
    <select>
      <option>
    -------- View More Poems --------
      </option>
      <option onclick='location.href="http://www.wordlocker.com/poems/dark-day"'>
    &lt;-- Previous Poems
      </option>
      <option onclick='location.href="http://www.wordlocker.com/poems/one-year"'>
    One Year
      </option>
      <option onclick='location.href="http://www.wordlocker.com/poems/the-conversation")>
    The Conversation...
      </option>
      <option onclick='location.href="http://www.wordlocker.com/poems/thats-okay"'>
    That's Okay
      </option>
      <option onclick='location.href="http://www.wordlocker.com/poems/the-riddle"'>
    The Riddle
      </option>
      <option onclick='location.href="http://www.wordlocker.com/poems/swim"'>
    They're Swimming
      </option>
    </select>
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2005
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That doesn't seem to work either, although still works in FF.

  4. #4
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this works in both IE and Firefox.

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>
    
    <BODY>
    <select onChange="window.location.href = this.value;">
      <option>
    -------- View More Poems --------
      </option>
      <option value="http://www.wordlocker.com/poems/dark-day">
    &lt;-- Previous Poems
      </option>
      <option value="http://www.wordlocker.com/poems/one-year">
    One Year
      </option>
      <option value="http://www.wordlocker.com/poems/the-conversation">
    The Conversation...
      </option>
      <option value="http://www.wordlocker.com/poems/thats-okay">
    That's Okay
      </option>
      <option value="http://www.wordlocker.com/poems/the-riddle">
    The Riddle
      </option>
      <option value="http://www.wordlocker.com/poems/swim">
    They're Swimming
      </option>
    </select>
    </BODY>
    </HTML>


  5. #5
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Reason for this is that IE does not support the onclick event on the <option> tag.


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
  •