aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes add or remove an item from drop down Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "add or remove an item from drop down " Watch "add or remove an item from drop down " New topic
Author

add or remove an item from drop down

dinesh rackson
Greenhorn

Joined: Oct 22, 2007
Posts: 9
i have two combo boxes,
combo box1 has numbers (one,two,three,four).
and combo box2 has (red,green,yellow).
now if i select "one" from combo box1, then only "red" and "yellow" should appear in combo box2,
but if i select "two" or "three" or "four".. all the three "red","green","yellow" should appear in combo box2..

the bottom line is i need to add and remove item from a combo box dynamically using java script function in a jsp.

can someone help me on this,
i googled a lot but couldn find a solution.
[ October 22, 2007: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61412
    
  67

First, a terminology correction. They are not "combo boxes". They are dropdowns or select elements. A combo box is a type of control avaulable in desktop applications that is not available on the web.

Get yourself a good JavaScript DOM reference and look up the API for the select element. There are methods to do what you are asking.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
dinesh rackson
Greenhorn

Joined: Oct 22, 2007
Posts: 9
sorry..
i meant drop down list box only...
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
http://www.mredkj.com/tutorials/tutorial005.html

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: add or remove an item from drop down