Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / JavaScript / March 2007



Tip: Looking for answers? Try searching our database.

options[i].selected=false not working in IE7

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
noddy - 30 Mar 2007 07:43 GMT
I have a select element containing a list of names.
I also have a button to enable the user to enter a new name.
When the user clicks the new name button I want to any option
shown as selected to be unselected.

I do this successfully in FF with the following code:

var numOpts = document.getElementById('myList').length;
for(var i=0;i<numOpts;i++){
   document.getElementById('myList').options[i].selected=false;
}

However IE 7 does not deselect the previously selected option.

Is there some way I can get this to work in IE7 ?

TIA

N
noddy - 30 Mar 2007 08:00 GMT
Sorry to have wasted your time :(
I have just found the selectedIndex property :)

N
Richard Maher - 31 Mar 2007 01:18 GMT
Hi

> Sorry to have wasted your time :(
> I have just found the selectedIndex property :)
>
> N

What does you set SelectedIndex to? Does it take NULL?

Cheers Richard Maher
RobG - 31 Mar 2007 02:29 GMT
On Mar 31, 10:18 am, "Richard Maher" <maher...@hotspamnotmail.com>
wrote:
> Hi
>
[quoted text clipped - 4 lines]
>
> What does you set SelectedIndex to? Does it take NULL?

<URL: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-85676760 >

--
Rob
Richard Maher - 31 Mar 2007 23:08 GMT
Hi Rob,

> On Mar 31, 10:18 am, "Richard Maher" <maher...@hotspamnotmail.com>
> wrote:
[quoted text clipped - 11 lines]
> --
> Rob

Thanks, I'll give -1 a go and see what happens. This answer might be in
there as well. but just in case, can you tell me how to change the
for/background color of the Select Bar?

Cheers Richard Maher
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.