I would like to once select Apple, it will display value 10, once select Orange, it iwll display value 20, or once select Pear, it will display 30. But now it didn't work, i blieve, the syntax has problem:

if mylist.options[mylist.selectedIndex]==0
y.value=10

Can you help me to check this ? Thansk.

<html>
<head>
<script type="text/javascript">
function favBrowser()
{
var mylist=document.getElementById("myList")

var y =document.getElementById("favorite")


if mylist.options[mylist.selectedIndex]==0
y.value=10


if mylist.options[mylist.selectedIndex]==1
y.value=20


if mylist.options[mylist.selectedIndex]==2
y.value=30

}
</script>
</head>

<body>
<cfform>
Select your favorite browser:
<select id="myList" onchange="favBrowser()">
<option>Apple</option>
<option>Orange</option>
<option>Pear</option>
</select>
<p>Your favorite browser is: <input type="text" id="favorite" size="20"></p>
</cfform>
</body>

</html>