473,543 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.mysel ect.options[i].text = 'foo'
document.forms['myform'].elements.mysel ect.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 1193
Robin Johnson wrote:
In an ordinary select element I can change the text and value of the various
options using

document.forms['myform'].elements.mysel ect.options[i].text = 'foo'
document.forms['myform'].elements.mysel ect.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
8058
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
4847
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 and can't figure out how to make it work in, for instance, Firefox. Right now the code I am using is as follows: ...
1
1580
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... What happens is a modal dialog recieves a listing of users in a semi-colon delimited list so its like this user_1;user_2;user3;user_4; what I need...
4
3049
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 have a form element: <form METHOD="post" ACTION="Scale_New.asp" id="Scale_New" name="Scale_New">
1
2450
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 guy's Javascript "combo box" - http://sandy.mcarthur.org/javascript/select/select.html. It allows my users (when I get some!) to select from a list of...
5
2208
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. The row source for combo2 is: SELECT DISTINCT tblComplaintCategory.fldComplaintCategory, tblComplaintCategory.fldComplaintCategoryID,...
1
2739
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 SELECT's children, or by creating a new Option() and setting it to the select.options array. My problem is in IE whenever it adds the element the...
2
4766
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 only the first element has the connection name in it. Any idea why this is? Thank you for your help. Some code for your reference. let me know if...
0
7582
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7726
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7329
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7675
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5257
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3385
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1809
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
948
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
626
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.