我这个代码有问题么?为什么就是显示不出来?
<html>
<head>
<title>22</title>
<script type="text/javascript">
function count(){
var t1 = document.getElementById("txt1").value;
var t2 = document.getElementById("txt2").value;
var s1 = document.getElementById("select").value;
var s2;
switch(s1) {
case "+":
s2 = parseFloat(t1) + parseFloat(t2);
break;
case "-":
s2 = parseFloat(t1) - parseFloat(t2);
break;
case "*":
s2 = parseFloat(t1) * parseFloat(t2);
break;
default:
s2 = parseFloat(t1) / parseFloat(t2);
}
return document.getElementById("fruit").value =s2;
}
</script>
</head>
<body>
<input type='text' id='txt1' />
<select id='select'>
<option value='+'>+</option>
<option value="-">-</option>
<option value="*">*</option>
<option value="/">/</option>
</select>
<input type='text' id='txt2' />
<input type='button' value=' = ' onclick="count()"/> <!--通过 = 按钮来调用创建的函数,得到结果-->
<input type='text' id='fruit' />
</body>
</html>
我改过了 把oTxt1改为t1 oTx2改为t2都还是不行 为什么???