原生Javascript制作计算器
X:
F:
Y:
R:
再给大家分享一个稍微复杂些的计算器
无标题文档 body,ul{ margin:0px; padding:0px;} body{ background:#AF6332} li{ list-style:none;} .fl{ float:left;} .fr{ float:right;} .clearfix:after{ content:""; display:block;clear:both} .clearfix{zoom:1;} .calBox{ width:460px; padding-bottom:10px;background:#FDFDFD; border-radius:5px; position:absolute; left:50%; top:50%; margin-left:-230px; margin-top:-225px; box-shadow:0px 0px 10px rgba(0,0,0,0.8),0px 0px 10px rgba(0,0,0,0.5) inset; -webkit-box-shadow:0px 0px 10px rgba(0,0,0,0.8),0px 0px 10px rgba(0,0,0,0.5) inset; background:#F9F9F9; overflow:hidden} input{ width:406px; height:82px; margin:10px 7px 0px; border-radius:5px; border:1px solid #64655F; box-shadow:0px 5px 2px rgba(157,157,145,0.8) inset; -webkit-box-shadow:0px 5px 2px rgba(157,157,145,0.8) inset; outline:none; background:#FCFDEB; text-align:right; font-family:"微软雅黑"; font-size:40px; padding:0px 10px;} ul{} li{ list-style:none; width:74px; height:34px; line-height:34px; text-align:center; font-family:"微软雅黑"; border:1px solid #8B8B8B; border-radius:5px; background:url(img/calBg) repeat-x; float:left; margin:12px 6px 0px;} .one li{ height:44px; background:url(calBg1.jpg) repeat-x; line-height:44px;cursor:pointer;} .one .orange{ background:url(calBg2.jpg) repeat-x; border:1px solid #875733;} .one .black{ background:url(calBg3.jpg) repeat-x; border:1px solid #363636; color:#fff;} .one .gray{ background:url(calBg4.jpg) repeat-x; border:1px solid #5F6366;} .zero{ width:160px;} .one .deng{ background:url(calBg5.jpg); height:100px;} .twoBox{ width:353px; overflow:hidden; } .two{ width:358px;} .calBox .three { margin:0px} .calu{ padding:0px 10px; width:470px;}
- 开机
- 关机
- 清屏
- +/-
- 1/x
- 7
- 8
- 9
- /
- %
- 4
- 5
- 6
- *
- √
- 1
- 2
- 3
- -
- 0
- .
- +
- =
效果图演示



