473,378 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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

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
Mar 30 '07 #1
4 6114
Sorry to have wasted your time :(
I have just found the selectedIndex property :)

N
Mar 30 '07 #2
Hi

"noddy" <no***@toyland.comwrote in message
news:eh********************************@4ax.com...
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
Mar 31 '07 #3
On Mar 31, 10:18 am, "Richard Maher" <maher...@hotspamnotmail.com>
wrote:
Hi

"noddy" <n...@toyland.comwrote in message

news:eh********************************@4ax.com...
Sorry to have wasted your time :(
I have just found the selectedIndex property :)
N

What does you set SelectedIndex to? Does it take NULL?
<URL: http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-85676760 >

--
Rob

Mar 31 '07 #4
Hi Rob,

"RobG" <rg***@iinet.net.auwrote in message
news:11**********************@o5g2000hsb.googlegro ups.com...
On Mar 31, 10:18 am, "Richard Maher" <maher...@hotspamnotmail.com>
wrote:
Hi

"noddy" <n...@toyland.comwrote in message

news:eh********************************@4ax.com...
Sorry to have wasted your time :(
I have just found the selectedIndex property :)
N
What does you set SelectedIndex to? Does it take NULL?

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

--
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
Mar 31 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: dixie | last post by:
I have a command to open the Access Options dialogue from code: DoCmd.RunCommand acCmdOptions It also opens the Database Window behind it. Is it possible to open the Options without having...
10
by: dhnriverside | last post by:
Hi guys Still having a problem with this dropdownlist. Basically, I've got 4. The first 2 work fine, then my code crashes on the 3rd. ddlEndTimeHour.Items.FindByValue(endTime).Selected =...
8
by: Matt Kruse | last post by:
Using the latest version of Opera 8.5, this test case: -------------------------------------------------------- <select name="sel" multiple="true" size="3"> <option value="option1"...
2
by: ahmad | last post by:
when i used the statment for(var i = 0; i < menu.length; i++) { menu.options.selected = "false"; } to deselect all the options within a list, it surprisingly selected all the options. I tried...
1
by: Ben | last post by:
I have a formview with a few dropdownlists (software version, database version, etc). When a software version is selected, the database version dropdownlist updates itself accordingly. When in...
0
by: Wayne Erfling | last post by:
I put in the code below to disable self links in a menu control in a "master" page. It works properly if the top-level menu item has no children, but both ..Selected = false and .NavigateUrl =...
5
by: consonanza | last post by:
I am working on a report filter form. It has 2 combo boxes (cmboSelectSubject and cmboSelectCategory) to select criteria. Selecting an entry in combo 1 restricts the options available in combo 2....
1
by: madflytom | last post by:
Hello, I'm trying to move the options of one select list to another select list. The "source" select list is divided into optgroups, and the "target" select list is not. I want to somehow keep...
1
by: madflytom | last post by:
Hello again all. I posted a question last night about dealing with <optgroups> in select boxes. We've changed directions, and now I need a little more help. Here's the scenario: Two select...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.