473,511 Members | 15,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drop down Lists

Hi,

I have the requirement of autoupdating the drop down lists , when a
selectin is done in another drop down box. I dont have a server through
which i can make it dynamic. I have to hard code it in the html. Can
someone suggest anything.

Prof

Jan 5 '07 #1
4 1379
Prof wrote:
I have the requirement of autoupdating the drop down lists , when a
selectin is done in another drop down box. I dont have a server through
which i can make it dynamic. I have to hard code it in the html. Can
someone suggest anything.
<form>
I'm looking for:
<select name="sel1" size="1"
onChange="pop2(this.options[this.selectedIndex].value)">
<option value="">-</option>
<option value="cars">cars</option>
<option value="accommodation">accommodation</option>
</select>
<br>
Further selection:
<select name="sel2" size="1">
<option value="">-</option>
</select>
<select name="sel3" size="1">
<option value="">-</option>
</select>
</form>
<script type="text/javascript">
var cars = new Array('Audi', 'BMW', 'Opel');
var car_colors = new Array('white', 'metallic', 'black');
var acc = new Array('Brussels', 'Antwerp', 'Ghent')
var acc_types = new Array('studio', 'house', 'villa');
var hyphen = new Array('-');
var S2 = document.forms[0].sel2;
var S3 = document.forms[0].sel3;

function pop2(c) {
while (S2.options.length) S2.options[0] = null;
while (S3.options.length) S3.options[0] = null;
if (c == '') { fill(hyphen, S2); fill(hyphen, S3) }
if (c == 'cars') { fill(cars, S2); fill(car_colors, S3) }
if (c == 'accommodation') { fill(acc, S2); fill(acc_types, S3) }
}

function fill(arr, el) {
for (var i = 0; i < arr.length; i++)
el.options[el.length] = new Option(arr[i], arr[i]);
}
</script>

Hope this helps,

--
Bart

Jan 5 '07 #2

Prof wrote:
Hi,

I have the requirement of autoupdating the drop down lists , when a
selectin is done in another drop down box. I dont have a server through
which i can make it dynamic. I have to hard code it in the html. Can
someone suggest anything.

Prof
hi, have you ever heard about ajax, you can update drop down list
automatically,

Jan 5 '07 #3
Prof wrote:
I have the requirement of autoupdating the drop down lists , when a
selectin is done in another drop down box. I dont have a server
through which i can make it dynamic. I have to hard code it in the
html. Can someone suggest anything.
http://www.JavascriptToolbox.com/lib/dynamicoptionlist/

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Jan 5 '07 #4
Thanks bart that was really helpfull.

Jan 11 '07 #5

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

Similar topics

3
14207
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.NET / VB page where i have a few 4 groups of Drop Down Lists. Each group of Drop Down Lists include 3 Drop Down Lists for date such as: DAY, MONTH, and YEAR. I don't want...
13
5210
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data...
2
12595
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
1
2034
by: csgraham74 | last post by:
Hi Guys, I am currently building a web aplication in ASP.Net. On the onload event of a page a have a function to populate the many drop down lists on my page. I have one parameter table which...
7
6301
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.NET / VB page where i have a few 4 groups of Drop Down Lists. Each group of Drop Down Lists include 3 Drop Down Lists for date such as: DAY, MONTH, and YEAR. I don't want...
1
2085
by: accyboy1981 | last post by:
Hi, I new to C# so please forgive me if this is simple. I've got 2 drop down lists the first is hard coded with data where as the second is populated from a database. The options that appear in...
0
1839
by: kajir | last post by:
Hi, I am new at using ASP.Net 2.0. I have various drop down lists on my master page. They refer to an SQL database. I also have a menu on the master page. I can select the values in the drop...
3
7331
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
22
3409
by: Archanak | last post by:
Hi, I am using 2-level CSS Drop Down Menu in my perl/CGI program. here is the code. #!c:/perl/bin/perl.exe use CGI qw(:standard);
3
5853
by: jcassan | last post by:
Hello folks. I am new to these forums and have something, which has been stumping me for little while. I am using pspell to spellcheck a scrolling textbox (textarea) containing user input. I...
0
7237
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
7349
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,...
1
7074
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
7506
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...
1
5063
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
4734
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
3219
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3210
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.