<html>
<head>
<script>
function displayResult(selTag)
{
var x=selTag.options[selTag.selectedIndex].text;
alert("You selected: " + x);
}
</script>
</head>
<body>
<form>
Select your favorite fruit:
<select onchange="displayResult(this)">
<option>Apple</option>
<option>Orange</option>
<option>Pineapple</option>
<option>Banana</option>
</select>
</form>
</body>
</html>