473,406 Members | 2,713 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,406 software developers and data experts.

Adding options to select on a PocketPC

Hello,

I'm writing some dynamic forms code for running on a PocketPC (running Windows
2003). There is to be a set of select menus, and choosing a particular option
in one menu changes the options available in the next.

In an ordinary select element I can change the text and value of the various
options using

document.forms['myform'].elements.myselect.options[i].text = 'foo'
document.forms['myform'].elements.myselect.options[i].value = 'foo_value'

but I can't change the length of the options array: options.length doesn't
seem to accept assignment or the ++ operator (as I'm used to using for IE6 on
a desktop machine), or the method add(). If I can't add (and remove) options
I'll have to resort to a static number of options in the select, and just
blank out the ones I don't want, which I can do but is a bit unmannerly. I'd
appreciate it if anyone can help.

--
Robin Johnson
http://www.robinjohnson.f9.co.uk - rj@[no-spam]robinjohnson.f9.co.uk
"The labours of men of genius, however erroneously directed, scarcely ever fail
in contributing ultimately to the solid advantage of mankind." - Mary Shelley
Jul 23 '05 #1
1 1186
Robin Johnson wrote:
In an ordinary select element I can change the text and value of the various
options using

document.forms['myform'].elements.myselect.options[i].text = 'foo'
document.forms['myform'].elements.myselect.options[i].value = 'foo_value'

but I can't change the length of the options array: options.length doesn't
seem to accept assignment or the ++ operator (as I'm used to using for IE6 on
a desktop machine), or the method add().


var o = document.forms['myform'].elements['myselect'].options;
o[o.length] = new Option("text", "value");

works in all browsers (that implement DOM Level 0 as of NS/IE 3+).
PointedEars
Jul 23 '05 #2

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

Similar topics

6
by: Scott | last post by:
The code below appears to work on the following: MAC - Safari PC - IE PC - Opera But the addition of items to the dropdown (select2) does not function in: MAC – IE
10
by: David | last post by:
Can anyone give me a quick code snippet (that is standards-based) for adding OPTION tags to a SELECT dynamically. I have no problem doing it in IE but I am kind of new to the whole standards world...
1
by: Brian Henry | last post by:
I haven't worked with java script much, I know how to do this server side by constant post backs to the server on a webform, but it seems like i should be able to do this client side also... ...
4
by: Rob | last post by:
Hi, Is there anything wrong with this code or does new Option just not work very well. I have a select box on my form: <select name="FirstLine" size="5" style="width:122px;"> </select> and I...
1
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this...
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: Josh C. | last post by:
I am attempting to dynamically add an option to a select box when the box is selected (click or focus). This works fine using Firefox by either creating a new element and appending it to the...
2
by: ketty_ng81 | last post by:
No matter how many dial up networking entries I have, the RASWrapper.RasEnumEntries(null , null , entryNames, ref cb, out entries); always returns the right number of elelments in entryNames but...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.