求计算器简单加减乘除功能代码



计算器
<!-- 外部css -->

<!-- 外部移动层JS -->

<!-- 外部计算功能JS -->


<br> div{width:100%;height:800px;background:gray;}<br>


简单的计算器
<!-- 表单 -->

<!-- 层的边框大小样式颜色 -->






























            </tr>

        </table>
        </form>
    </div>
    </div>
</body>


这里如何添加计算功能 最好是可以连续加减乘除的 比如 1+2*3/2=



要用代码格式贴,这样根本无法阅读。

    <!-- 外部移动层JS -->
    <script language="javascript" src="src/js/yidong.js"></script>
    <!-- 外部计算功能JS -->
    <script language="javascript" src="src/js/jisuan.js"></script>
</head>
<style>
div{width:100%;height:800px;background:gray;}
</style>
<body bgcolor="teal"><center/>
    <div  onmousemove="mouseMove()">
    <div id="ceng" onmousedown="mouseDown()" onmouseup="mouseUp()" style="top:100px;left:400px;position:absolute;width:350px;height:420px;cursor:url(src/img/箭头-国旗.ani),defanlt;">简单的计算器
    <!-- 表单 -->
    <form>
    <!-- 层的边框大小样式颜色 -->
        <table id="tb" style="border:10px inset #88bef4" align="center">
                <td colspan="4">
                    <input type="text" id="kg"/>
                </td>
            </tr>
            <tr>
                <td><input type="button" value="1" id="kg1"/></td>
                <td><input type="button" value="2" id="kg1"/></td>
                <td><input type="button" value="3" id="kg1"/></td>
                <td><input type="button" value="+" id="kg1"/></td>
            </tr>
            <tr>
                <td><input type="button" value="4" id="kg1"></td>
                <td><input type="button" value="5" id="kg1"/></td>
                <td><input type="button" value="6" id="kg1"/></td>
                <td><input type="button" value="-" id="kg1"/></td>
            </tr>
            <tr>
                <td><input type="button" value="7" id="kg1"/></td>
                <td><input type="button" value="8" id="kg1"/></td>
                <td><input type="button" value="9" id="kg1"/></td>
                <td><input type="button" value="*" id="kg1"/></td>
            </tr>
            <tr>
                <td><input type="button" value="." id="kg1"/></td>
                <td><input type="button" value="0" id="kg1"/></td>
                <td><input type="button" value="%" id="kg1"/></td>
                <td><input type="button" value="/" id="kg1"/></td>
            </tr>
            <tr>
                <td><input type="button" value="C" id="kg1"/></td>
                <td><input type="button" value="←" id="kg1"/></td>
                <td colspan="2"><input type="button" value="=" id="kg2"/></td>

            </tr>

        </table>
        </form>
    </div>
    </div>
</body>

首先,一个页面中不要使用如此多的id。
http://www.tuicool.com/articles/BB3Uzy