473,467 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Iterating comboboxes (<SELECT>) using javascript

G'day all

I apologise in advance for the newbiness of this question, but the
answer has eluded me for 3 days now - hopefully one of you gurus out
there might be able to help .......
I have a page that dynamically draws checkboxes with a combo. I'm
then
attempting to use the following code to iterate through each combo
box
and change the value to match the text box.
Here's the code that calls the functions, and the
functions themselves......
**Code that fires the event
<input class="ctlstandard" type="text" name="txtSeats" id="txtSeats"
onblur="setOptionCombos);"/>&nbsp;<font color="<
%=session("BrandTextColour")%>">*</font></td>
**The function
function setOptionCombos(){
var lSeats=frmMain.txtSeats.value;
for (i=0;i<frmMain.cboTourOptionQty.length;i++){
frmMain.cboTourOptionQty[i].selectedIndex=lSeats-1;
}

}
This works if there are two combos on the screen, but does not when
there's only one. It seems the event doesn't, although all get
changed
quite happily when there's 2 or more.

If there are 2 combos, the expression
frmMain.cboTourOptionQty.length=2
If there's only 1 combo, the expression
frmMain.cboTourOptionQty.length=100 (the number of options in the
list)
Any help or thoughts would be greatly appreciated :)
Cheers,
Doug.

Oct 15 '07 #1
1 4297
On Oct 15, 4:13 am, Melbfella <d...@dodeonline.comwrote:
G'day all
[snip]
>
Any help or thoughts would be greatly appreciated :)
http://groups.google.com/group/comp....43daa67bc03345

Same mistake, different element.

Oct 15 '07 #2

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

Similar topics

2
by: Andrea | last post by:
Hi, I'm trying to emulate part of our client-server application as a web site so customers can use it, and I'm stuck when it comes to re-ordering items in a list. Basically we have a list of...
7
by: Hal Vaughan | last post by:
I have a sample script from a book ("Beginning JavaScript" by Paul Wilton) that removes or adds a choice to a <SELECT> element. The <FORM> is form1 and the <SELECT> is theDay. The example uses...
3
by: Chamomile | last post by:
I've only just come accross this newsgroup, so apologies if I seem to be cross-posting... this may be an old chestnut, but has anyone ever come accross a straightforward way of styling a...
6
by: Marek Mänd | last post by:
I searched google but couldnt find ant decent code for dependant comboboxes script (where the combo values in other combo depend upon the selections in the first combobox). The problem is that...
6
by: Bonge Boo! | last post by:
This has got to be obvious, but I can't make it work. I have a form called with 3 pull down menus. They are linked to a database which generates the values for the <SELECT? Pull-downs. Lets...
4
by: joiv | last post by:
I'm making a <select></select> with lots of <option></option>. It contains all possible options. Because of the length of the list, I also have an <input type="text">. This is what I wish to do:...
6
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this...
6
by: joseph.lindley | last post by:
Forgive me for I am a bit of a web-dev novice - but I'm not doing too bad. I'm currently working with a bit of javascript to dynamically add <option>s into a select box. My code currently works...
14
mikek12004
by: mikek12004 | last post by:
In a form I have 5 elements (e.g. pictures) and I wish for the user to be able to set the order of appearance. For this I have for each picture a select box (names select1 to select5) with "please...
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
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
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,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.