For example if a listbox has an id “countryList” following can be the function call.
listbox_selectall('countryList', true); //select all the options
listbox_selectall('countryList', false); //deselect all the options
When you submit the form with Listbox, by default browser will submit only selected values from that selectbox. Thus if you want to submit values from right hand side select box, you first needs to select all those before form gets submitted.
You can do this like below: