您的位置:首页 > 其它

简易版网页版计算器

2015-09-20 21:41 423 查看
<!DOCTYPE html>

<html>

<head>

    <meta charset=utf-8 />

    <title>网页版计算器</title>

    <script src="SimpleCalculator.js" type="text/javascript" charset="utf-8"></script>

    <link href="SimpleCalculator.css" rel="stylesheet" type="text/css"/>

</head>

<body>

    <div>

        <table>

           <tr>

                <td colspan="3">

                    <input type="text" id="result" value="0." />

                </td>

                <td>

                    <button type="button" onClick="clearAll();">C</button>

                </td>

                <td>

                    <button type="button" onClick="clearLast();">CE</button>

                </td>

            </tr>

            <tr>

                <td>

                    <button type="button" onClick="getNum('7');" value="7">7</button>

                </td>

                <td>

                    <button type="button" onClick="getNum('8');" value="8">8</button>

                </td>

                <td>

                    <button type="button" onClick="getNum('9');" value="9">9</button>

                </td>

                <td>

                    <button type="button" onClick="pn();">+/-</button>

                </td>

                <td>

                    <button type="button" onClick="getOp('%');" value="%">%</button>

                </td>

            </tr>

            <tr>

                <td>

                    <button type="button" onClick="getNum('4');" value="4">4</button>

                </td>

                <td>

                    <button type="button" onClick="getNum('5');" value="5">5</button>

                </td>

                <td>

                    <button type="button" onClick="getNum('6');" value="6">6</button>

                </td>

                <td>

                    <button type="button" onClick="getOp('+');" value="+">+</button>

                </td>

                <td>

                    <button type="button" onClick="getOp('-');" value="-">-</button>

                </td>

            </tr>

            <tr>

                <td>

                    <button type="button" onClick="getNum('1');" value="1">1</button>

                </td>

                <td>

                    <button type="button" onClick="getNum('2');" value="2">2</button>

                </td>

                <td>

                    <button type="button" onClick="getNum('3');" value="3">3</button>

                </td>

                <td>

                    <button type="button" onClick="getOp('*');" value="*">*</button>

                </td>

                <td>

                    <button type="button" onClick="getOp('/');" value="/">/</button>

                </td>

            </tr>

            <tr>

                <td colspan="2">

                    <button type="button" onClick="getNum('0');" value="0">0</button>

                </td>

                <td>

                    <button type="button" onClick="getNum('.');" value=".">.</button>

                </td>          

                <td>

                    <button type="button" onClick="getResult();">=</button>

                </td>

                <td>

                    <button type="button" id="back" onClick="clearLast();">返回</button>

                </td>

            </tr>

        </table>    

    </div>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: