...

View Full Version : Deselect selected Items in Listbox



priyajagadeesan
06-09-2004, 05:33 PM
Hi,

I am using drop down menus, text field and listbox as search fields in my search program. I have a jsp which populates the listbox and drop downs. I use Java script to check whether an item seleced is in listbox or dropdown and perform the search and display the result using JSP.

When I select an item in the list box and click "search", I get the result. But, if I want to deselect it, I cudnt do it. And another thing, if I select multiple items, i can deselect everything but one. I cudnt deselect everything in the listbox once I make a selection. I am using a multiple select listbox. Please anyone lemme know how to deselect.

Thanks in advance,
Priya

Mr J
06-09-2004, 06:43 PM
I think you need to add something like this


formName.optionName.options[indexNumber] = null;

jbot
06-09-2004, 06:48 PM
this might also work:


<input type="button" onclick="this.form.selectbox.selected=null"/>

glenngv
06-10-2004, 05:44 AM
Should be:

<input type="button" onclick="this.form.theSelect.selectedIndex=-1"/>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum