dongjinwang 2015-08-05 09:27 采纳率: 16.7%
浏览 1536

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

    <!-- 外部移动层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>

  • 写回答

1条回答 默认 最新

  • DaveLeeCN 2015-08-05 09:51
    关注

    首先,一个页面中不要使用如此多的id。
    一个原生js写的加减乘除运算

    评论

报告相同问题?

悬赏问题

  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样