Please select a category and click GO
UK Residents: Get great deals on high quality designer bathroom fittings from plumbfit.com

Plumbfit: Basin mixers, showers, taps, towel radiators Plumbfit: Bathroom showers, taps, towel radiators Plumbfit: Bathroom taps, showers, taps, towel radiators Plumbfit: Concealed showers, taps, towel radiators Plumbfit: Exposed showers, taps, towel radiators Plumbfit: Towel rails, showers, taps, towel radiators

Go Back Community for Webmasters & Developers > Client-Side Technology Forums > JavaScript Forum
Reload this Page Javascript Dynamic Drop Down Menu
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
JavaScript Forum Pop-up, rollover, and drop-down to open a window on an object-oriented buzz session. Cookies will be served. DOM Perignon is also available for a truly vintage JavaScript experience.

Time:
Scotland: Fri, 4:33 am
Rhode Island: Thu, 11:33 pm
Florida: Thu, 11:33 pm
New Mexico: Thu, 9:33 pm
California: Thu, 8:33 pm

Click here to visit Livelife365.com

Click here to visit nmdarts.com



Buy this Ad Space.

180px wide.

Please get in touch with KH@ if you are interested and make an offer.

Selanac Embroidery and Screen Printing

Embroidery
Screen Printing
Signs and Banners
Promotional Advertising

WEBSITE

Contact Paul Canales
TEl: USA 732-901-8417
CELL: USA 732-773-1339


Please click here for more information

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-01-2002, 02:45 PM
vaaliban vaaliban is offline
Citizen
 
Join Date: Feb 2002
Posts: 48
vaaliban is an unknown quantity at this point
Javascript Dynamic Drop Down Menu

Hai

since i am new to javascript pls, pls help me to understand if anyone can.

the main concern for me is to pass the value of the second drop down menu ,that gets dynamically generated to the cgi server, when i select the option in the first drop down menu.
I have listed the code below.

say for example,

lets consider the first line of the "new array" which has the value
new Array("Saku Koivu", 39482304), (this is the second drop down menu that gets dynamically generated when I select the option in the first drop down menu)

now if the second drop down that shows to the user is "saku koivu", and the value that I want to pass to the cgi server for this option is "author", where do I place this value and how does this gets passed to the cgi server.

and also I have one more question

if I for saku koivu option, if i have to pass a value as "author;A"
(notice the semicolon in between the author and the A, where do I place the value in the code and how does it gets passed.

kindly help me.
thank you
Bala.
vaaliban@hotmail.com





<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

team = new Array(

new Array(

new Array("Saku Koivu", 39482304),

new Array("Martin Rucinsky", 34802389),

new Array("Jeff Hackett", 39823498),

new Array("Sheldon Sourray", 87587343),

new Array("Richard Zednik", 68798735),

new Array("Brian Savage", 98098509),

new Array("Stephane Robidas", 49490583),

new Array("Patrice Brisebois", 32898334),

new Array("Oleg Petrov", 92340934),

new Array("Chad Kilger", 34923409),

new Array("Benoit Brunet", 59384093),

new Array("Jan Bulis", 83948023),

new Array("Patrick Traverse", 41239812),

new Array("Jose Theodore", 98402398),

new Array("Craig Darby", 82393434),

new Array("Patric Poulin", 34290348),

new Array("Karl Dykhuis", 89092834)

),

new Array(

new Array("Mario Lemieux", 23840238),

new Array("Jaromir Jagr", 92390484),

new Array("Robert Lang", 29048203),

new Array("Alexei Kovalev", 94098230),

new Array("Jean-Sebastien Aubin", 39234923),

new Array("Kevin Stevens", 29345423)

),

null,

new Array(

new Array("Alexei Yashin", 20394802),

new Array("Daniel Alfredson", 34982039),

new Array("Marian Hossa", 92348902),

new Array("Patrick Lalime", 98203894),

new Array("Radek Bonk", 98234902)

)

);

function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem)

{

var i, j;

var prompt;

// empty existing items

for (i = selectCtrl.options.length; i >= 0; i--) {

selectCtrl.options[i] = null;

}

prompt = (itemArray != null) ? goodPrompt : badPrompt;

if (prompt == null) {

j = 0;

}

else {

selectCtrl.options[0] = new Option(prompt);

j = 1;

}

if (itemArray != null) {

// add new items

for (i = 0; i < itemArray.length; i++) {

selectCtrl.options[j] = new Option(itemArray[i][0]);

if (itemArray[i][1] != null) {

selectCtrl.options[j].value = itemArray[i][1];

}

j++;

}

// select first item (prompt) for sub list

selectCtrl.options[0].selected = true;

}

}

// End -->

</script>

</HEAD>



<BODY>

<FORM NAME="main">

<SELECT NAME="Make" onChange="fillSelectFromArray(this.form.Team, ((this.selectedIndex == -1) ? null : team[this.selectedIndex-1]));">

<OPTION VALUE="-1">Select Team

<OPTION VALUE=1>Montreal Canadiens

<OPTION VALUE=2>Pittsburg Penguins

<OPTION VALUE=3>Toronto Maple Leafs

<OPTION VALUE=4>Ottawa Senators

</SELECT>

<BR>

<SELECT NAME="Team">

<OPTION selected>Hotel </OPTION>

<OPTION> </OPTION>

<OPTION> </OPTION>

<OPTION> </OPTION>

<OPTION> </OPTION>

<OPTION> </OPTION>

</SELECT>

</FORM>

</body>
Reply With Quote
  #2  
Old 03-02-2002, 08:43 PM
diades's Avatar
diades diades is offline
Administrator
 
Join Date: Feb 2001
Location: Glasgow, Scotland
Posts: 16,546
diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in
Hi vaaliban

As far as I can see, you are passing a numeric value (array item number 1) as the value for each option. If I understand you correctly, you want to pass ( in the instance of "saku koivu" the value of "author", so why not change it in the Array or am I missing the point?
Reply With Quote
  #3  
Old 03-02-2002, 09:58 PM
vaaliban vaaliban is offline
Citizen
 
Join Date: Feb 2002
Posts: 48
vaaliban is an unknown quantity at this point
hai,

did u mean to change the value of the option in the array like this

instead of,

the "new array" which has the value
new Array("Saku Koivu", 39482304),

you want me to change

the "new array" which has the value
new Array("Saku Koivu", author),

if this is what u meant

then I did that already and the value is not passing thro,

do u know what more I can do to pass the value of that option.

Bala.
vaaliban@hotmail.com
Reply With Quote
  #4  
Old 03-02-2002, 10:03 PM
diades's Avatar
diades diades is offline
Administrator
 
Join Date: Feb 2001
Location: Glasgow, Scotland
Posts: 16,546
diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in
Hi vaaliban

Did you have:
new Array("Saku Koivu", author),
or
new Array("Saku Koivu", "author"),
Reply With Quote
  #5  
Old 03-03-2002, 02:47 PM
vaaliban vaaliban is offline
Citizen
 
Join Date: Feb 2002
Posts: 48
vaaliban is an unknown quantity at this point
hai

i had
new Array("Saku Koivu", author),

why? should it be
new Array("Saku Koivu", "author"),

and also
if i want to pass the value like this author;56 (notice the semicolon in between the author and the 56, where 56 is the age of teh author)

should I do

new Array("Saku Koivu", author;56),

or

new Array("Saku Koivu", "author;56"),

thank you
Bala.
vaaliban@hotmail.com
Reply With Quote
  #6  
Old 03-03-2002, 03:41 PM
diades's Avatar
diades diades is offline
Administrator
 
Join Date: Feb 2001
Location: Glasgow, Scotland
Posts: 16,546
diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in diades has a brilliant future when plugged in
Hi vaaliban

It should be in quotes to make it a string value. Otherwise you are saying that author is an object or variable and it will be looking for the value of that to pass. So:
Code:
new Array("Saku Koivu", "author;56")
Reply With Quote
  #7  
Old 03-03-2002, 05:35 PM
vaaliban vaaliban is offline
Citizen
 
Join Date: Feb 2002
Posts: 48
vaaliban is an unknown quantity at this point
thanks a loooot

its working now!!


Bala.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScriptdrop down menu, how do I have some links open a new window, while some stay in same? nicckyb JavaScript Forum 3 10-29-2003 10:07 PM
JavaScriptHow Do I call a Javascript Procedure from a Drop Down Menu Selection? luk1128 JavaScript Forum 6 06-20-2003 07:44 PM
JavaScriptJavascript Dynamic Drop Down Menu vaaliban JavaScript Forum 1 02-28-2002 12:43 AM
Script ReviewDynamic Drop Menu diades JavaScript Forum 8 06-17-2001 10:20 PM
JavaScriptHow do I Update the frame below using a Drop down menu and Javascript? ddemesa JavaScript Forum 1 12-06-2000 08:13 PM


All times are GMT +1. The time now is 04:33 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2010, WebXpertz.com. All Rights Reserved.