请大家帮帮忙看哪里有问题,总是算不出结果嘞
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>holiday review</title>
<script type="text/javascript">
function do(){
var num1=document.getElementById('num1').value;
var num2=document.getElementById('num2').value;
var result="";
var opt=document.getElementById('select').value;
switch(opt)
{
case "+":result=parseInt(num1)+parseInt(num2);
break;
case "-":result=parseInt(num1)-parseInt(num2);
break;
case "*":result=parseInt(num1)*parseInt(num2);
break;
case "/":result=parseInt(num1)/parseInt(num2);
break;
default:
break;
}
document.getElementById('result').value=result;
}
</script>
</head>
<body>
<input type='text' id='num1'/>
<select id='select'>
<option value='+'>+</option>
<option value='-'>-</option>
<option value='*'>*</option>
<option value='/'>/</option>
</select>
<input type='text' id='num2'/>
<input type='button' value="=" onclick="do()"/>
<input type='text' id='result'/>
</body>
</html>