function getSelection(o){ if (!o.options) return ""; var selectedOptions = []; for (var i = 0; i < o.options.length; i++) if (o.options[i].selected) selectedOptions.push(o.options[i].value); return selectedOptions.join(","); }