Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners remove item from list box using java script
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


suganya
remove item from list box using java script
1 Answer(s)      6 years and 3 months ago
Posted in : Java Beginners



Advertisement
View Answers

October 22, 2008 at 1:20 PM


Hi friend,

Code to remove list box item using java script :

<html>
<head>
<title>Add or Remove Options in Javascript</title>
<script language="javascript" >

function addItem(selectbox,text,value )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}


function addItems(selectbox){
addItem(document.list.item, "One","One");
addItem(document.list.item, "Two","Two");
addItem(document.list.item, "Three","Three");
addItem(document.list.item, "Four","Four");
addItem(document.list.item, "Five","Five");
addItem(document.list.item, "Six","Six");

}


function removeItems(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
//selectbox.options.remove(i);
selectbox.remove(i);
}
}

function removeItem(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
if(selectbox.options[i].selected)
selectbox.remove(i);
}
}

</script>
</head>

<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000" onload="addItems()";>
<FORM name="list">
<SELECT id="item" NAME="item" MULTIPLE size=6 width=10>
</SELECT><br>
<input type=button onClick="removeItem(item)"; value='Remove Selected Item'>
<input type=button onClick="removeItems(item)"; value='Remove All Item'>
</form>
</body>

</html>


For read more information on Javascript visit to :

http://www.roseindia.net/javascript/

Thanks


Related Tutorials/Questions & Answers:
remove item from list box using java script - Java Beginners
remove item from list box using java script  remove item from list box using java script  Hi friend, Code to remove list box item using java script : Add or Remove Options in Javascript function addItem
how to insert list box in java script dynamically and elements retrieving from database like oracle
how to insert list box in java script dynamically and elements retrieving from... box in javascript when elements retrieving from database.. That is whenever I insert new course in a table.. It should be seen in my list box
Advertisements
how to insert list box in java script dynamically and elements retrieving from database like oracle
how to insert list box in java script dynamically and elements retrieving from database like oracle  hi all, how can i insert elements into java script list box retrieving from Database. whenever I insert any element in the Db
How to obtain the selected data item from a list box when listbox contains objects wrapped under Arraylist?
How to obtain the selected data item from a list box when listbox contains... want to copy the selected item(one at a time) from the list box to the text box. I... and a text box. I am sending an Array List object from a servlet to this jsp
java script text box
java script text box  hi, I created a button when i click... in alert). i also want the text box should generate in front of NEW button(next/prev) and after it submits it should show before the NEW line.dont add again two box
How to access the "Add/Remove Programs" list in Control Panel using Java Program? - Java Beginners
How to access the "Add/Remove Programs" list in Control Panel using Java Program?  Dear Sir, I'm very interested in creating java programs innovatively. I've planned to write a java coding for accessing the Add/Remove
Scrolling List Box. - Java Beginners
Scrolling List Box.  How can is make a list box scrollable by using method ? Please give me the code snipetts
Scrolling List Box. - Java Beginners
Scrolling List Box.  How can is make a list box scrollable by using method ? Please give me the code snipetts
Not Able to select an Item in Spark Combo Box control (Adobe Flex Object) using QTP
Not Able to select an Item in Spark Combo Box control (Adobe Flex Object) using... Flex controls. But i am not able to select any item from Spark Combo Box. I tied using .Open (Its not opening the drop down list) , also i tried using Select
jsp list box - Java Beginners
jsp list box  I have two list boxs. the values for the first list box is retrieved from the mysql database. I want to fill the second list box selected item from the database. Please help me in this regard. Your help
Scrolling List Box. - Java Beginners
Scrolling List Box.  How can is make a list box scrollable by using... ListSelectionListener { private JList list; private DefaultListModel listModel..."); //Create the list and put it in a scroll pane. list = new
how to make drop down list in JSF & fetch data Item from database
how to make drop down list in JSF & fetch data Item from database  how to make drop down list in JSF & fetch data Item from database
Adding checkbox to List as item
Adding checkbox to List as item   can we add checkox to List  ...(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList list = new JList(new...(MouseEvent event){ JList list = (JList) event.getSource(); int
delete an item from database
delete an item from database  how to delete an item from the database using jsp
Passing Multi select list box values using ajax to get values to dependent list box
Passing Multi select list box values using ajax to get values to dependent list box  Hi, I have a jsp page which has 3 dependent list boxes... the dependent values to the immediate next list box. Please help me
how to remove the column from a java web page
how to remove the column from a java web page  i have a web page with account#, qtr, year if i want to remove the year column which is a drop down list from my jsp what should i do and what is the process please give a brief view
retrive the data from access database to drop down list box in jsp
retrive the data from access database to drop down list box in jsp  hai, im new to jsp now im using the jsp along with access database.in table i load all the data's i need to retrive the data from database to dropdown list box
write a program to remove the element from hashset using keyboard.
write a program to remove the element from hashset using keyboard.  write a program to remove the element from hashset using keyboard
awt list item* - Swing AWT
awt list item*  how do i make an item inside my listitem... frame=new Frame("Add list"); Label label=new Label("What is your Choice...); choice.add("Java "); choice.add("Jsp"); choice.add("Servlets
barcode reader using java script
barcode reader using java script  Hai all, I need code for one application in java and java script my requirement is, Scanning data directly... in the appropriate field that is to receive the data from the scan and the trigger is pressed
dynamic drop down list box - Java Beginners
dynamic drop down list box  hi all , I want to dynamically populate a drop down box from an sql query in a servlet program, using only html...(); ResultSet rs = st.executeQuery("select * from Combolist"); List ulist = new
How to access Widows" Add/Remove Programs List"? - Java Beginners
How to access Widows" Add/Remove Programs List"?  Dear Friends, How to access the Windows' Add/Remove Program List? Is there any special jar to add for acccessing it? Kindly provide me the solution.... Thanks & Regards
Dynamic loading of Combo box list using servlet - JSP-Servlet
Dynamic loading of Combo box list using servlet  I have the category... I give theortical descrption read it! Select a value from drop dwon box... * from Combolist"); List ulist = new ArrayList(); List clist = new ArrayList
Need to remove duplicated rows from excel using apache POI API
Need to remove duplicated rows from excel using apache POI API  Hi... to remove duplicated rows from excel sheet by using apache poi api oe jxl api... to remove duplicated rows from excel. same as below i need to do by using apache
How to remove virtual keypad from apps java
How to remove virtual keypad from apps java  I have an galaxy smart s6830 touch Chinese Mobile (240x320) (myriad java platform) (esmertec jbed) and I need to remove keypad from apps . I have put the following into the jar file
How to remove virtual keypad from apps java
How to remove virtual keypad from apps java  I have an galaxy smart s6830 touch Chinese Mobile (240x320) (myriad java platform) (esmertec jbed) and I need to remove keypad from apps . I have put the following into the jar file
How to remove virtual keypad from apps java
How to remove virtual keypad from apps java  I have an galaxy smart s6830 touch Chinese Mobile (240x320) (myriad java platform) (esmertec jbed) and I need to remove keypad from apps . I have put the following into the jar file
List the names of classes used to create button and text box in Java.
List the names of classes used to create button and text box in Java.  List the names of classes used to create button and text box in Java
Add/Remove Rows Dynamically with drop down list in html table using php
Add/Remove Rows Dynamically with drop down list in html table using php  Here Is My Code. I want to give and get the id of drop down list. Can Anyone... the following link: JSP Add Remove row using Javascript
Without Using Form in Java Script
Without Using Form in Java Script  HOw to Reset the data in javascript without using form tag
List Box - JSP-Servlet
List Box  sir i am developing webb application.am using drop down list box.on selecting one value in list box,i will retrieve values from database and store into another list box in same page using javascript :location.my
Advertisements
 

 

 

DMCA.com