answersLogoWhite

0


Best 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>

User Avatar

Wiki User

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you add item in listbox through the textbox?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you add verification steps to tests?

we can add verification steps through various Checkpointsin QTPWe can also verify the script through VerifyFilemethod.


What is the Difference between combo box and list box in visual basic?

LISTBOX CONTROLCOMBOX CONTROLA LISTBOX CONTROL displays a list of items from which theuser can select one or more. If the number of items exceeds the number that can be displayed, a scroll bar is automatically added to the List Box control.a list box is appropriate when you want to limit input to what is on the listchoices not on the list can be typed in this field.A COMBOX CONTROL combines the features of a text box and a list box. This control allows the user to select an item either by typing text into the combo box, or by selecting it from the list.a combo box is appropriate when there is a list of suggested choicesA combo box contains an edit field.


What does the word Graft mean?

It means to add something to another to form one new item. Typically used in surgery to add tissue from one part of the body to cover a damaged area.


Write an algorithm to insert an item to a given location in sorted array?

To insert a number N into array A at index I: // Resize A if necessary If A is too small to add a new element then resize A // Right-shift all elements starting from position I For i = A.length to I A[i] = A[i - 1] // Insert new item A[I] = N


How do you use string in visual basic?

A string is a data set in the form of alphanumeric characters and symbols. For example, if you wanted to use a string to concatenate and display a welcome message displaying a user's name, your code would look something like this: Dim WelcomeMessageString as String = "Welcome to the string demonstration " Dim FormResponseString as String = form1.text Message(WelcomeMessageString + FormResponseString)

Related questions

How do you add a sound in a textbox in PowerPoint presentation?

You can add a text box easily in Power point. Along with the text box, there is an option for adding sound also.


How do you create notepad in vbnet?

Create a new form and put a textbox in it. Et voila. You can add extra things like change font, size, word wrap, find/replace, print etc.. but bear in mind that you cannot change colour in a textbox. Well, you can but if you want to save it - you need to save it as a .RTF document so it saves the styles (bold, italic, colour etc.) - so i would use a richtextbox instead of a textbox.


How do you add things to your cart at target com?

When you want an item put your curser on the button "add to cart" and do that with each item until done.


How do you favourite a story on Harry Potter fanfiction?

You did not specify the web-site.On fanfiction.net it is easy: if you are a registered user, you will find a listbox at the end of the chapter/story, the first options is "Add Story to Favorites", so you only have to click button Go.


What does it mean to add?

It means you are taking one number or item and adding it to another item or number.


How do you find the total cost of a item with tax?

First you calculate the amount of the tax on the item. Then you add together the original cost of the item and the tax.


What happens when you add a 25TH item to the office clipboard?

nothhing


What happens when you add the 25th item to the office clipboard?

nothhing


How do you add items to your giftlist on IMVU?

If you're in the shop window of the imvu client and you see an item that you want to add to your giftlist, simply click on the item and at the bottom of the popup window there will be a "more info: link. When you click that it will bring you to the IMVU product page and you can simply click the "add to giftlist" link under the item.


How do you write a java program to find the tax on the item and the item's total cost?

You simply multiply the tax rate with the item's original cost and divide by hundred, to get the tax. Then you add that to the original cost, to get the total cost. In Java you use + to add, * to multiply, and / to divide.


How do you make add to my basket?

To add items to your basket, simply click on the &quot;add to basket&quot; or &quot;add to cart&quot; button next to the item you want to purchase. The item will then be placed in your virtual shopping basket for checkout. You can continue browsing and adding more items before proceeding to complete your purchase.


If i buy something from amazon.com can I get insurance on it?

If you purchase a product or service through amazon.com they do offer insurance to cover your item in case something happens. You may add this on to your cart at the end of the purchase.