Detecting selected values in a multiple <option select> list

admin

Administrator
Staff member
I have the following code which lets me find the value selected in a pop-up window.
<html>
<script language="javascript">
if (document.form1.customer_type.options[document.form1.customer_type.selectedIndex].value =="")
{
alert("Please select a customer type.")
document.form1.customer_type.focus();
return false;
}
</script>

<body>
<form>
<select size="1" name="customer_type" tabindex="9" id="required">
<option value=http://www.webdeveloper.com/forum/archive/index.php/"" selected>Customer Type
<option value="Good">Good
<option value="Bad">Bad
<option value="Ugly">Ugly

</select>

</form>
</body>

</html>

That code works fine. However, I have a small variation which I'm not sure how to code.

<select name="outbound" size="5" multiple id="required">
<option selected>Customer Type
<option value=http://www.webdeveloper.com/forum/archive/index.php/"Goodly">Goodly
<option value="Badly">Badly
<option value="Uglyly">Uglyly
</select>

I am not sure how to code the javascript to detect multiple selected values. Any help is appreciated.
 
Back
Top