<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<script src="https://www.imooc.com/static/lib/jquery/1.9.1/jquery.js"></script>
</head>
<body>
<form>
<input class="h1">
<select id="cs" >
<option value="1">加法</option>
<option value="2">减法</option>
<option value="3">乘法</option>
<option value="4">除法</option>
</select>
<input class="h2">
<input type="button" value="=" onclick="add2()" >
<input class="h3" >
</form>
<script type="text/javascript">
function add2(){
var a=$(".h1").val();
var b=$(".h2").val();
var v=$("#cs").val();
if(v=="1"){var sum = parseInt(a) + Number(b);
$(".h3").val(sum);
}
if(v=="2"){var sum = parseInt(a) - Number(b);
$(".h3").val(sum);
}
if(v=="3"){var sum = parseInt(a) * Number(b);
$(".h3").val(sum);
}
if(v=="4"){var sum = parseInt(a) / Number(b);
$(".h3").val(sum);
}
}
</script>
</body>
</html>