Category: JavaScript
Passing selected values from listbox to textbox

Sending a selected item from a listbox to a textbox is not a very big deal for a script programmer at server end. But doing it at client-end(browser-end) is really make the involvement of JavaScript. There are others browser-end script to get this type of output but JavaScript is the best client-end scripting for working with any browser at user interaction.

Put the JavaScript in <script> </script> tag and input elements under <body> </body> tag as following:

function display()

var dpt=document.getElementById("DropDownList1");

document.getElementById("category").value =dpt.options[dpt.selectedIndex].value;
< <body> input type="text" name="category" size="50" id="category" />
<select name="sel_category" size="10" multiple="multiple" ID="DropDownList1" runat="server" onchange="display();">
</select> </body>