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 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2005
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    <select> behaves in FF not IE

    Can anybody tell me why this isn't working in IE, I want it to go to the url when the option is clicked. Those addresses are default, but doesn't matter it doesn't go to them anyways. I've taken the ()'s out too, doesn't work in IE that way either.

    Code:
    <select>
      <option>
    -------- View More Poems --------
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poems/poemtitle")'>
    &lt;-- Previous Poems
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poems/poemtitle")'>
    One Year
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poems/poemtitle")'>
    The Conversation...
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poemtitle")'>
    That's Okay
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poems/poemtitle")'>
    The Riddle
      </option>
      <option onclick='location.href=("http://www.wordlocker.com/poems/poemtitle")'>
    They're Swimming
      </option>
    </select>

  • #2
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,703
    Thanks
    0
    Thanked 233 Times in 228 Posts
    Hi there 700lbGorilla,

    try it like this...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <script type="text/javascript">
    window.onload=function() {
    document.getElementById('poems').onchange=function() {
    if(this.value!='') {
       location.href=this.value;
       }
      }
     }
    </script>
    
    </head>
    <body>
    
    <div>
    <select id="poems">
      <option value="">-------- View More Poems --------</option>
      <option value="http://www.wordlocker.com/poems/poemtitle">&lt;-- Previous Poems</option>
      <option value="http://www.wordlocker.com/poems/poemtitle">One Year</option>
      <option value="http://www.wordlocker.com/poems/poemtitle">The Conversation...</option>
      <option value="http://www.wordlocker.com/poemtitle">That's Okay</option>
      <option value="http://www.wordlocker.com/poems/poemtitle">The Riddle</option>
      <option value="http://www.wordlocker.com/poems/poemtitle">They're Swimming</option>
    </select>
    </div>
    
    </body>
    </html>
    
    coothead

  • #3
    New Coder
    Join Date
    Aug 2005
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you, worked perfectly!

  • #4
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It does not work, because the onclick event does not get triggered in IE. You have to use onchange event to make it compatible


  •  

    Posting Permissions

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