计算器 案例
来源:互联网 发布:bmob后端云 java 编辑:程序博客网 时间:2024/05/19 21:01
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Insert title here</title><style type="text/css"> .panel { border: 4px solid #ccc; width: 202px; margin: 50px auto; } .panel p,.panel input{ font-family: "黑体"; font-size:20px; margin:5px; float:left; } .panel p{ border:4px solid #ddd; height:30px; width:123px; padding:5px; } .panel input{ height:40px; width:40px; }</style> <script type="text/javascript"> function cal(e) { var obj = e.target || e.srcElement; if(obj.nodeName != "INPUT") { return; } var value = obj.value; var screen = document.getElementById("screen"); if(value=="C") { screen.innerHTML = ""; } else if (value=="=") { var exp = screen.innerHTML; try { var r = eval("("+exp+")"); screen.innerHTML = r; } catch(e) { console.log(e); screen.innerHTML = "Error"; } } else { screen.innerHTML += value; } } </script></head><body> <div class="panel" onclick="cal(event);"><div> <p id="screen"></p> <input type="button" value="C"> <div style="clear:both"></div></div><div> <input type="button" value="7"> <input type="button" value="8"> <input type="button" value="9"> <input type="button" value="/"> <input type="button" value="4"> <input type="button" value="5"> <input type="button" value="6"> <input type="button" value="*"> <input type="button" value="1"> <input type="button" value="2"> <input type="button" value="3"> <input type="button" value="-"> <input type="button" value="0"> <input type="button" value="."> <input type="button" value="="> <input type="button" value="+"> <div style="clear:both"></div> </div></div></body></html>
0 0
- 计算器 案例
- 案例:JSP计算器
- web计算器案例
- 小案例-简易计算器
- Android学习-计算器案例
- 09-13 网页计算器案例
- jsp+javaBean开发计算器案例
- 小案例--网页版计算器
- Model1模式案例简单的计算器
- C语言程序设计案例精编----简易计算器
- 我的Android案例—计算器
- 安卓线性布局案例之计算器
- Python案例-开发之路-计算器
- 用java编写的计算器案例
- 基于VC的MFC计算器案例步骤及源代码
- Android系列案例2:android开发简易计算器
- (转)基于VC的MFC计算器案例步骤及源代码
- Android基础综合案例(七)《简易计算器UI界面设计》
- CSS总结3
- [翻译] We have a problem with promises
- CSS总结4
- javascript总结1
- javascript总结2
- 计算器 案例
- Leetcode 419 Battleships in a Board
- javascript总结3
- 第二大整数
- 经典案例: 购物车
- kmp算法解析
- 如何启动、关闭和设置ubuntu防火墙
- spring mvc 处理方法的返回方式:ModelAndView, Model, ModelMap, Map,View, String, void
- @Controller(2) 详解@RequestMapping