Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-30-2006, 10:33 PM   PM User | #1
700lbGorilla
New Coder

 
Join Date: Aug 2005
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
700lbGorilla is an unknown quantity at this point
<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>
700lbGorilla is offline   Reply With Quote
Old 12-30-2006, 11:04 PM   PM User | #2
coothead
Senior Coder

 
coothead's Avatar
 
Join Date: Jan 2004
Location: chertsey, a small town 25 miles south west of london, england.
Posts: 1,549
Thanks: 0
Thanked 195 Times in 191 Posts
coothead will become famous soon enough
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
coothead is offline   Reply With Quote
Old 12-31-2006, 12:06 AM   PM User | #3
700lbGorilla
New Coder

 
Join Date: Aug 2005
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
700lbGorilla is an unknown quantity at this point
Thank you, worked perfectly!
700lbGorilla is offline   Reply With Quote
Old 12-31-2006, 04:44 PM   PM User | #4
nemo5
New to the CF scene

 
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
nemo5 is an unknown quantity at this point
It does not work, because the onclick event does not get triggered in IE. You have to use onchange event to make it compatible
nemo5 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:02 AM.


Advertisement
Log in to turn off these ads.