Javascript: adding/removing values from txtbox from listbox
Posted: Sat Jun 18, 2011 3:28 pm
hi everyone,
i'm new to javascript. i have the following code appending emails together together into a textbox when items are selected from a listbox. i have two issues.
1. the first selection passed to the emailcc textbox always appears as:
, johnsmith@home.ca
2. i'd like the ability to click on the listbox again to remove the email addresses selected from the textbox if email addresses in the list box are clicked a second time.
whats the best way to accomplish this? thanks.
<script type="text/javascript" language="JavaScript">
function Copy_listbox(){
document.emailaddresses.emailcc.value += ", " + document.emailaddresses.SelectEMailccListBox.value;
}
</script>
i'm new to javascript. i have the following code appending emails together together into a textbox when items are selected from a listbox. i have two issues.
1. the first selection passed to the emailcc textbox always appears as:
, johnsmith@home.ca
2. i'd like the ability to click on the listbox again to remove the email addresses selected from the textbox if email addresses in the list box are clicked a second time.
whats the best way to accomplish this? thanks.
<script type="text/javascript" language="JavaScript">
function Copy_listbox(){
document.emailaddresses.emailcc.value += ", " + document.emailaddresses.SelectEMailccListBox.value;
}
</script>