<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
<pre lang="cs">var myform = document.getElementById("someform")
for (var i = 0; i < myform.elements.length; i++)
if (myform.elements[i].type == "select-one" || myform.elements[i].type == "select-multiple") {
myform.elements[i].className = "selectclass"
}
}
<title>Dropdown Alert</title>
</head>
<body>
<form action="HTMLPage.htm">
<h1>Choose one option at a time</h1>
<select id="sample" onchange="alertselected(this)">
<option value="val0">GMAIL</option>
<option value="val1">TWITTER</option>
<option value="val2">FACEBOOK</option>
<option value="val3">INSTAGRAM</option>
<option value="val4">FLIXTER</option>
</select>
<input type="button" onclick="alertselected(document.getElementById())" value="alert" />
</form>
</body>
</html></pre>