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

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 1665
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.selectedIndex = num;
}

</script>
</head>

<body>

<form name="aform">

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

<p>
<a href="javascript:setme(0);">set bananas</a><p>
<a href="javascript:setme(1);">set kokos</a><p>
<a href="javascript:setme(2);">set 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
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...
12
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
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. ...
5
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...
5
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...
3
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...
19
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...
5
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...
5
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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,...

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.