点击按钮,没结果
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script type="text/javascript">
function count(){
var num1 =parent(document.getElementById("txt1").value);
var num2 =parent(document.getElementById("txt2").value);
var cs =parent(document.getElementById("jishu").value);
var sums;
switch(cs){
case "+":
sums=num1+num2;
case "-":
sums=num1-num2;
case "*":
sums=num1*num2;
case "/":
sums=num1/num2;
}
document.getElementById("fruit").value = 5;
}
</script>
</head>
<body>
<input type='text' id="txt1" />
<select id='jushu'>
<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>