错在哪里,ReferenceError: count is not defined,一直找不到
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>函数的编程练习</title>
</head>
<script type="text/javascript">
window.onload=function () {
var oText1=document.getElementById('text1').value;
var oText2=document.getElementById('text2').value;
var oLie=document.getElementById('lie').value;
var oFriut=document.getElementById('friut').value;
var result="";
function count() {
switch (oLie) {
case "+":
result=oText1+oText2;
break;
case "-":
result=oText1-oText2;
break;
case "*":
result=oText1*oText2;
break;
default:
result=oText1/oText2;
break;
}
oFriut=result;
}
};
</script>
<body>
<input type="text" name="text1" id="text1">
<input type="text" name="text2" id="text2">
<select id="lie">
<option id="+">+</option>
<option id="-">-</option>
<option id="*">*</option>
<option id="/">/</option>
</select>
<input type="button" name="btn" id="btn" onclick="count()">
<input type="text" name="friut" id="friut">
</body>
</html>