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 01-17-2009, 06:58 PM   PM User | #1
andydrizen
New to the CF scene

 
Join Date: Jan 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
andydrizen is an unknown quantity at this point
Question option tag with javascript in IE6 issue

Hi, I want to use the following code. In Firefox it works as I want it to, but in IE6 the javascript doesn't work - could anybody suggest a fix for me?

Code:
<select size='3' >
<option onmousedown='javascript:alert("you selected ONE");'>ONE</option>
<option onmousedown='javascript:alert("you selected TWO");' disabled='disabled'>TWO</option>
<option onmousedown='javascript:alert("you selected THREE");'>THREE</option>
</select>


Thanks,
Andy

Last edited by andydrizen; 01-17-2009 at 07:01 PM..
andydrizen is offline   Reply With Quote
Old 01-17-2009, 07:24 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Try this:-

Code:
<form name= "myform">
<select name = "optList" onchange = "showChoice()" size='3' >
<option value = "ONE" >ONE</option>
<option value = "TWO">TWO</option>
<option value = "THREE">THREE</option>
</select>
</form>

<script type = "text/javascript">

function showChoice() {
var pick = document.myform.optList.value;
alert ("You selected " + pick)
}
</script>

We have been asked to correct our report on the wedding last week. On return from honeymoon the happy couple will be staying at The Old Manse and not as we stated at the home of the bridegroom's father. - Newspaper paragraph.
Philip M is offline   Reply With Quote
Users who have thanked Philip M for this post:
andydrizen (01-17-2009)
Old 01-17-2009, 07:36 PM   PM User | #3
andydrizen
New to the CF scene

 
Join Date: Jan 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
andydrizen is an unknown quantity at this point
Thanks :-) That deals with most of it - what about keeping one field disabled?
andydrizen is offline   Reply With Quote
Old 01-17-2009, 08:09 PM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by andydrizen View Post
Thanks :-) That deals with most of it - what about keeping one field disabled?
I am not too clear why you would want to do that (surely an option is an option?) but for an explanation of an IE bug see:-

http://www.lattimore.id.au/2005/07/0...ript-solution/

Or you might try something like:-

Code:
<script type = "text/javascript">

function showChoice() {
var pick = document.myform.optList.value;
alert ("You selected " + pick);
if (pick == "ONE") {
alert ("That option is not available");
return false;
}
}
</script>
Philip M is offline   Reply With Quote
Old 01-17-2009, 11:32 PM   PM User | #5
andydrizen
New to the CF scene

 
Join Date: Jan 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
andydrizen is an unknown quantity at this point
Thanks for your assistance
andydrizen is offline   Reply With Quote
Reply

Bookmarks

Tags
ie6, issue, javascript, option, select

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 02:44 PM.


Advertisement
Log in to turn off these ads.