js计算器

2018-07-19  本文已影响0人  WANGLIN_HZ
<!DOCTYPE html>
<html>
<head>
    <title>计算器</title>
    <script type="text/javascript">
        window.onload = function(){
            var ow1 = document.getElementById("w1");
            var oselect = document.getElementById("select");
            var ow2 = document.getElementById("w2");
            var ow3 = document.getElementById("w3")
        ow3.onclick = function(){
            var val01 = ow1.value;
            var val02 = ow2.value;
            var sel = oselect.value;
        }
        }
    </script>
</head>
<body>
    <h1>计算器</h1>
    <input type="text" id="w1">
    <select id="select">
        <option value="0">+</option>
        <option value="1">-</option>
        <option value="2">*</option>
        <option value="3">/</option>
    </select>
    <input type="text" id="w2">
    <input type="button" value="计算" id="w3">
</body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读