How do you add item in listbox through the textbox?
-
-
Answer:
This can be done with a little javascript. Here's an example <html> <head> <script type="text/javascript" language="javascript"> function addNewItem() { // Retrieve the elements from the document body var textbox = document.getElementById('MyTextbox'); var listbox = document.getElementById('MyListbox'); // Now we need to create a new 'option' tag to add to MyListbox var newOption = document.createElement('option'); newOption.value = textbox.value; // The value that this option will have newOption.innerHTML = textbox.value; // The displayed text inside of the <option> tags // Finally, add the new option to the listbox listbox.appendChild(newOption); } </script> </head> <body> <input id="MyTextbox" type="textbox" /> <input type="button" value="Add Item" onclick="javascript:addNewItem()" /> <br /><br /> <select id="MyListbox" size="10"> <option value="apples">Apples</option> <option value="oranges">Oranges</option> <option value="bananas">Bananas</option> </select> </body> </html>
wiki.answers.com Visit the source
Related Q & A:
- How To Track My Item On Australia Post?Best solution by auspost.com.au
- How to select specific data from listbox?Best solution by stackoverflow.com
- How do I add an item to Finder's sidebar?Best solution by Stack Overflow
- How to send an item through USPS?Best solution by usps.com
- How do I add my own item to amazon?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.