本文实例讲述了thinkPHP框架实现的简单计算器。分享给大家供大家参考,具体如下:
HTML部分 文件名 index.html
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>计算器</title> <script type="text/javascript" src="public/js/jquery-2.2.3.js"></script> <link rel="stylesheet" href="public/css/index.css" rel="external nofollow" ></head><body> <div class="login"> <span>登录</span> </div> <div class="register"> <form action=""> <span>请输入你的手机号开始使用</span> <br><br> <input id="myphone" type="text"> <input id="use" type="button" value="使用"> <br><br> </form> </div> <div class="calculator"> <div class="counter"> <span class="brand">计算器</span> <br><br> <input class="import" type="text" style="text-align: right;"> <br><br> <form class="snap" action=""> <br><br> <input class="order" id="one" type="button" value="1"> <input class="order" id="two" type="button" value="2"> <input class="order" id="three" type="button" value="3"> <input class="order" id="four" type="button" value="4"> <input class="order" id="five" type="button" value="5"> <br><br> <input class="order" id="six" type="button" value="6"> <input class="order" id="seven" type="button" value="7"> <input class="order" id="eight" type="button" value="8"> <input class="order" id="nine" type="button" value="9"> <input class="order" id="zero" type="button" value="0"> <br><br> <input class="operator" id="plus" type="button" value="+"> <input class="operator" id="add" type="button" value="-"> <input class="operator" id="mul" type="button" value="*"> <input class="operator" id="sub" type="button" value="/"> <input class="" id="equal" type="button" value="="> <br><br> <input class="order" type="button" value="."> <input id="backspace" type="button" value="←"> <input id="clear" type="button" value="c"> <input type="button" value="CE"> <input type="button" value="MC"> </form> </div> <div class="result"> <div> <span>当前结果:</span><span id="current_results"></span> </div> <br><br> <span>历史记录:</span> <ul id="cal_result" style="list-style-type: none"> <li><span>删除</span></li> </ul> </div> </div></body> <script type="text/javascript" src="public/js/index.js"> </script></html>
新闻热点
疑难解答