473,698 Members | 2,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

select of select box will select multiple in another box

Im trying to do the following:

I have 2 select boxes, both are pre populated with data. The first box
is a single select box, the 2nd is a multiple select box. Depending on
the 1st selection, I want to have multiple values in the second select
box highlighted.

ie
box 1
<select name=type>
<option> warm colors
<option> cool colors
<option> shades of grey
</select>

box 2
<select name=colors multiple>
<option> red
<option> orange
<option> yellow
<option> blue
<option> green
</select>

If the user would select warm colors from box 1, red, orange and
yellow would be highlighted for them. Any suggestions? Thanks.
Jul 20 '05 #1
1 1673
palmiere wrote:
Im trying to do the following:

I have 2 select boxes, both are pre populated with data. The first box
is a single select box, the 2nd is a multiple select box. Depending on
the 1st selection, I want to have multiple values in the second select
box highlighted.

ie
box 1
<select name=type>
<option> warm colors
<option> cool colors
<option> shades of grey
</select>

box 2
<select name=colors multiple>
<option> red
<option> orange
<option> yellow
<option> blue
<option> green
</select>

If the user would select warm colors from box 1, red, orange and
yellow would be highlighted for them. Any suggestions? Thanks.

Hi, it is actually not difficult.
Here is a piece of old examplecode to get you going:

<html>
<head>
<title> titel </title>
<script type="text/javascript">

function setme(num)
{
document.forms. aform.fruit.sel ectedIndex = num;
}

</script>
</head>

<body>

<form name="aform">

<select name="fruit">
<option value="bananas" >bananas</option>
<option value="kokos">k okos</option>
<option value="apple">a pple</option>
</select>
<input type=submit >
</form>

<p>
<a href="javascrip t:setme(0);">se t bananas</a><p>
<a href="javascrip t:setme(1);">se t kokos</a><p>
<a href="javascrip t:setme(2);">se t apple</a><p>
</body>
</html>

Regards,
Erwin Moller
Jul 20 '05 #2

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

Similar topics

3
3029
by: Max Weber | last post by:
Try to run the code below in a page. You will notice than when you switch the multiple attribute of the SELECT tag, only one option is displayed as selected although multiple options have ben created as selected. May somebody give me an explanation ? <input type="button" value="test" onclick="test()"/> <select name="tagSelect" style="width:100%"> </select>
12
8876
by: Forti2ude | last post by:
Hello, I have a simple form... <form> <select name="foo" multiple> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> </select>
6
4294
by: Ben Hallert | last post by:
Hi guys, I'm trying to figure out what bone headed mistake I made on something I put together. I've got a form (named 'context') that has a variable number of select-multiple inputs on it. Based on the number of variables passed through a GET string, I want to multiply the total number of selected items for each together to see how many possible combinations the selected items are generating. The following snippet of code...
5
2383
by: callmebill | last post by:
I'm relatively new to javascript, and I'm trying to decide whether the following (and if so, clues on how to do it): I'd like to create two HTML multiple-select boxes. The first would be a list of items, and the second would be a list of categories. By clicking a category in the 2nd box, the members of that category (from the first box) would be highlighted (indicated here by arrows). E.g., -- List of Nums -- -- Categories -- 1...
5
2175
by: GTi | last post by:
Whats wring with this code? <select class=EditField size="1" name="PlantUnitID" title="Select line"> <option value="0" >Standalone Unit</option> <option value="1" selected >Connected Unit 1</option> <option value="1" selected >Connected Unit 2</option> </select> <span onclick="NewWindow('pluginpage.html?EditUnitGUID='+this.form.PlantUnitID.options.value+'&DoPostBack=1','namexx',200,310);"
3
12552
by: imrantbd | last post by:
This is my first problem.Please help me. I have the following code: <head> <script language="JavaScript"> function addSrcToDestList() { destList1 = window.document.forms.destList; srcList = window.document.forms.srcList;
19
2990
by: hexagram | last post by:
Hi guys good day, can anybody help for my problem The Scenario is A Listbox (ID) - Multiple Select - everytime i choose in the list box the following outbound textbutton and subform will retrieve in my form- the folliwng value will get from another form i have a code but i need to customize it because everytime i choose ID in my list box my value in subform is multiplying by row i mean the value in subform is duplicating
5
13528
by: sticky | last post by:
Hi I need to be able to lock a table against INSERT and UPDATE, but not SELECT, for the duration of a transaction. The transaction will be defined at the application level in c#, and then use stored procedures to make multiple selects and then an insert. What is the best way of doing this? Description of the system:
5
3305
by: Max | last post by:
Is there any way to set a select-multiple type <select multiple="multiple"with multiple selected options in scripting? Any idea about this is appreciative.
0
8683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8871
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7739
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5862
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.