473,407 Members | 2,306 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,407 software developers and data experts.

dynamic drop-menu content?

LRW
I've a page where I have two form drop-menu. I need the second menu to
populate only with items based on what's selected in the 1st menu.

I have "Javescript in Easy Steps" and the closest it discusses is
populating list content based on a radio button, but the book is so
badly written, I'm having a horrible time trying to adjust using two
menus.

I did a Google for the sublect, and found
http://www.blazonry.com/javascript/js_menu.php which is easier to
understand, but I still can't get it to work.

All I need is a link to a good Web page that discusses this topic, and
I'll figure it out on my own. If anyone has any Web sites they know
that deal with this?
Thanks!

Liam
Jul 23 '05 #1
2 1631
two options...

use Arrays for items
or

//-------------start copy
<script language="Javascript">
function getItems(val) {
if (val) { //check that there IS a selection
made
document.getElementById("container").innerHTML =
document.getElementById("item"+val).innerHTML
}
}
</script>

<div id=item1 style="display:none">
<select name=itemsfor1>
<option>11111</option>
<option>11111111</option>
</select>
</div>
<div id=item2 style="display:none">
<select name=itemsfor2>
<option>22222</option>
<option>22222222</option>
</select>
</div>
<div id=item3 style="display:none">
<select name=itemsfor3>
<option>33333</option>
<option>33333333</option>
</select>
</div>

<form name=whateva>
<select name=select1 onchange="getItems(this.value)">
<option value="">Select</option>
<option value=1>Item list 1</option>
<option value=2>Item list 2</option>
<option value=3>Item list 3</option>
</select>
<div id=container></div>

</form>
//--------------------end copy

copy everything AS IS and place it in an html page and test it...

this was rushed, so forgive mistakes...

what you can do then is give each option in the item lists values and/or put
onchange events for those select boxes so that they do something.


"LRW" <de**@celticbear.com> wrote in message
news:3a**************************@posting.google.c om...
I've a page where I have two form drop-menu. I need the second menu to
populate only with items based on what's selected in the 1st menu.

I have "Javescript in Easy Steps" and the closest it discusses is
populating list content based on a radio button, but the book is so
badly written, I'm having a horrible time trying to adjust using two
menus.

I did a Google for the sublect, and found
http://www.blazonry.com/javascript/js_menu.php which is easier to
understand, but I still can't get it to work.

All I need is a link to a good Web page that discusses this topic, and
I'll figure it out on my own. If anyone has any Web sites they know
that deal with this?
Thanks!

Liam

Jul 23 '05 #2
LRW wrote:
I've a page where I have two form drop-menu. I need the second menu to
populate only with items based on what's selected in the 1st menu.


There are a lot of solutions out there, and a lot of them don't work as well
as they could.
Simple solutions that are often posted here work in the simplest
environments and most current browsers, but fail on others.

I have a dynamic option list library which is pretty robust and handles a
lot of features you might need (like default values when the page loads,
handling form reset, etc).
It's at http://www.mattkruse.com/javascript/dynamicoptionlist/

Hope that helps,

--
Matt Kruse
Javascript Toolbox: http://www.mattkruse.com/javascript/
Jul 23 '05 #3

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

Similar topics

31
by: NickName | last post by:
/* goal: dynamic evaluation of table row platform: sql 2000 */ use northwind; declare @tbl sysname set @tbl = 'customers' EXEC('select count(*) from ' +@tbl)
7
by: Yaro | last post by:
Hello Is it possible using dynamic SQL in UDF? In Sybase below example work but in DB2 UDB 8.1.3 I get error: "SQL0104N Unexpected element "EXECUTE IMMEDIATE" found....." CREATE FUNCTION...
5
by: mytestemailaccount | last post by:
Hi, Hope you can help. I am relatively new to all this but would appreciate the groups help. The scenario: I am c# and asp.net to create a web application. The web page contains a user...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
0
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string...
0
by: Steve Funk | last post by:
All, I have searched all around and have not yet found the answer to this nor a solution. Hopfully it will be easy to overcome. Here is what I am trying to do: I'm trying to build a wizard...
9
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have...
3
by: amcoldspy | last post by:
Hi, am trying to create dynamic drop down boxes.. there are 3 drop down boxes. The second drop down box elements are to be update based on the selection made in the first drop down box...
4
by: audreyality | last post by:
I am new to javascript and appreciate any guidance on this issue, so thank you in advance for your advice! Situation: I am working with a form that will send information to a database. I need the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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...

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.