简易版网页版计算器
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>
<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>
相关文章推荐
- 数据仓库&大数据学习 记录/笔记
- LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
- 后缀表达式
- 第12章类和动态内存分配
- PHP 7革新与性能优化
- Linux基础入门第三节(修改)
- Oracle 11g EM安全证书问题无法访问的解决办法
- AngularJS + RequireJS
- 深入理解IntentService
- Service kongleifeng深究
- 第 十 天 : 添 加 硬 盘 和 分 区 挂 载 等
- 大三第一学期实验报告
- 汇编总结:lea指令
- MVC5 + EF6 + Bootstrap3 (11) 排序、搜索、分页
- ios-新浪微博开发-18-(授权存储账号信息)用归档实现
- hdoj 4549 M斐波那契数列 【矩阵快速幂 + 费马小定理 + 快速幂】
- MySQL中group_concat函数,用符号连接查询分组里字段值
- 实验一 Linux初步认识
- 对Git的认识
- 从c到c++<一>