Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

add or remove an item from drop down

 
dinesh rackson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64972
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
dinesh rackson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry..
i meant drop down list box only...
 
Eric Pascarello
author
Rancher
Posts: 15385
6
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic