Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 2nd, 2004, 10:47 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default Listboxes and Arrays

Hi all,

I have 2 select boxes. I want the 2nd to be populated depending on what is selected in the first. This is simple enough. The catch here is that I want the 2nd to populated from an array which is linked to the choice in the first. However each array is different in length. So what Im faced with is creating extra options each time, depending on how many elements there are in the array associated with the choice made in the first select box. So if the user selected option 1, there may be 5 elements in its array, but if they select option 2, there may be 7 in its array.

Ideas?

Cheers
interrupt

__________________
\'sync\' <cr>
The name specified is not recognized as an internal or external command, operable program or batch file.
 
Old August 2nd, 2004, 01:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

You can access select options through the options property, as:

document.GetElementById('select1').Options

I think there is an add and remove, but am not sure.

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Listboxes Sub-Listboxes and Table Linking MJB05 Access 4 September 20th, 2005 12:37 PM
Listboxes and Arrays(Cot'd)... interrupt Javascript How-To 2 August 10th, 2004 11:03 PM
Filtering listboxes Bill Snow VB Databases Basics 0 February 5th, 2004 03:32 PM
Listboxes Alaric VS.NET 2002/2003 1 October 29th, 2003 11:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.