<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>计算器</title>
<script type="text/javascript">
var a = parseInt(document.getElementById("t1").value);
var b = parseInt(document.getElementById("t2").value);
function count(){
var ret;
switch( document.getElementById("select").value){
case"+":ret=a+b;break;
case"-":ret=a-b;break;
case"*":ret=a*b;break;
case"/":ret=a/b;break;
}
document.getElementById("t3").value=ret;
}
</script>
</head>
<body>
<form>
<input type="text" id="t1">
<select id="select">
<option value="+">+</option>
<option value="-">-</option>
<option value="*">*</option>
<option value="/">/</option>
</select>
<input type="text" id="t2">
<input type="button" value="=" onclick="count()">
<input type="text" id="t3">
</form>
</body>
</html>