<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no">
<meta http-equiv="Cache-Control" content="max-age=0">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>scroll</title>
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<style type="text/css">
</style>
</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=‘ = ‘ id="he"/> <!--通过 = 按钮来调用创建的函数,得到结果-->
<input type=‘text‘ id=‘fruit‘/>
</body>
</html>
<script type="text/javascript">
$("#he").on("click", function () {
var oneVal =parseInt( $("#txt1").val());
var twoVal = parseInt($("#txt2").val());
var selectVal = $("#select").val();
var con = $("#fruit");
var fh = $("#select option:selected").val();
var a=‘‘;
if (fh == "+") {
a=oneVal+twoVal;
} else if (fh == "-") {
a=oneVal-twoVal;
} else if (fh == "*") {
a=oneVal*twoVal;
} else {
a=oneVal/twoVal;
}
con.val(a);
})
</script>