473,408 Members | 1,821 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,408 software developers and data experts.

Populating Select Lists

This semester in school, I'm taking an Introduction to JavaScript class
online through my local community college. I'm having with an
assignment that requires you to set up two select lists. When you
select an option on the first list, it populates the second list with
specific information unique to that selection (Our example is to select
a state that would then populate a city list in the second). I can not
find any information or example to help with the script I need to
write, are there any suggestions?

Bryan

Oct 27 '06 #1
2 1283
ASM
br*************@gmail.com a écrit :
This semester in school, I'm taking an Introduction to JavaScript class
online through my local community college. I'm having with an
assignment that requires you to set up two select lists. When you
select an option on the first list, it populates the second list with
specific information unique to that selection (Our example is to select
a state that would then populate a city list in the second). I can not
find any information or example to help with the script I need to
write, are there any suggestions?
You could try to find infos about new Option()

new Option(value, text)
Example with :
- selct = selector (dropdown list)
- list = array of items (fruits, materials, states, towns ...)

function fillSelect(selct, list) {
// to empty selector
selct.length = 0;
// new options
for (var i=0; i<list.length; i++)
{
// new option : value and text
var o = new Option(list[i], list[i])
// grow selector adding new option
selct[selct.length] = o;
}
}

--
ASM
Oct 27 '06 #2

br*************@gmail.com wrote:
>to set up two select lists. When you
select an option on the first list, it populates the second list with
specific information unique to that selection (Our example is to select
a state that would then populate a city list in the second). I can not
find any information or example to help with the script I need to
write, are there any suggestions?
Where did you look? This homework question comes up so often that it's
difficult to avoid references to it.

Google: javascript +populate +"select box"

Oct 28 '06 #3

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

Similar topics

7
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
4
by: bobsawyer | last post by:
I've been building a series of SELECT lists that are populated dynamically using HTTPRequest. Things are going pretty well, and I've got the whole thing working flawlessly in Mozilla/Firebird....
3
by: to_rgoyal | last post by:
Hi All, I am creating one web base application using ASP.net and C#. I am populating dropdown lists of my web pages using database. I am using this code: con = new...
1
by: msnews.microsoft.com | last post by:
I'd like to hear your thoughts on best methods for populating drop down list controls. I have states and countries drop down lists that don't change often, so naturally I "hard code" them in the...
1
by: Patrick.O.Ige | last post by:
Doing the simple DropDown List binding using the method NextResult() But its just not populating .. what am i missing Its populating the 3 DropDwonList but no Data? Private Sub...
3
by: RFS666 | last post by:
Hello together, I tried to find out about populating an asp.net server control (a dropdownlist) from the clientside jscript, but I didn't find a solution up to now. I cannot use a html...
1
by: Stephene | last post by:
New to the world of web design/php/mysql and need help please. What I'm trying to do: I would like a web page with three drop down menus each populated by a query The first represents...
0
by: koonda | last post by:
Hi all, I have a Project due after one week. It is a web service project. I have a Web Form which communicates to the web service and this web service communicates to the database. I have all my...
1
Gyro
by: Gyro | last post by:
Hi all, I'm a php newbie and have read various posts/articles on populating select lists dynamically from a db table. However, I cant seem to get it working in the way I want... I have 3 select...
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...
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
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,...
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...

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.