<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
input { width: 60px; }
div { margin: 10px 0 }
</style>
<script type="text/javascript">
window.onload = function () {
// 获取元素
var num1 = document.getElementById('num1');
var num2 = document.getElementById('num2');
var ret = document.getElementById('ret');
var btns = document.getElementsByTagName('button');
var p = parseInt;
//为按钮添加点击事件,计算结果
}
</script>
</head>
<body>
<input id="num1" type="text"/>
<input id="num2" type="text"/>
<div>结果:<span id="ret"></span></div>
<button>+</button>
<button>-</button>
<button>*</button>
<button>/</button>
</body>
</html>