2016年6月2日 星期四

加法運算器

<!DOCTYPE html >
<html >
<head>
    <title>加法運算器</title>
<head>
    <title>加法運算器</title>
    <script>
        function add() {
            var a = parseInt(document.getElementById('a').value);
            var b = parseInt(document.getElementById('b').value);
            document.getElementById('result').value =  a+b ;
        }
    </script>
</head>
<body>
    <input id="a" type="text" />+<input id="b" type="text" />
    <button onclick="add()">=</button>
    <output id="result"></output>
</body>
</html>






沒有留言:

張貼留言