Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > select of select box will select multiple in another box

Reply
Thread Tools

select of select box will select multiple in another box

 
 
palmiere
Guest
Posts: n/a
 
      02-09-2004
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.
 
Reply With Quote
 
 
 
 
Erwin Moller
Guest
Posts: n/a
 
      02-09-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill Combo Box based on another Combo Box dthmtlgod ASP General 1 11-16-2005 04:08 PM
populate one list box with selected values from another list box steven.cooper@infocision.com ASP .Net 1 03-12-2005 11:29 PM
New to .NET, can I have one drop down box control the data of another drop down box using a database? SirPoonga ASP .Net 2 01-07-2005 10:44 PM
Dynamic selct box from another select box Robin ASP General 2 04-09-2004 06:17 PM
<select tag> - how do I set the current index in a multiple select box? Ferd Berfel Javascript 4 04-06-2004 06:53 PM



Advertisments