It’s as follows :
functionlistbox_selectall(listID, isSelect) {varlistbox = document.getElementById(listID);for(varcount=0; count < listbox.options.length; count++) {listbox.options[count].selected = isSelect;}}
onclick="listbox_selectall('countryList',true)"//select all the options
(or)
onclick="listbox_selectall('countryList',false)"//deselect all the options