本文实例为大家分享了Javascript代码实现简单计算器的具体代码,供大家参考,具体内容如下
一、实现功能(1)利用css样式、javascript语言和html语言实现计算器的算法 (2)对计算器的页面进行规划以及对界面进行颜色的填涂 (3)对界面各个边框边距进行适当的调整
二、展示1.代码展示
代码如下:
计算器 body{ padding:0;margin:0; background-color:bisque; } #calculator{ position:absolute; width:1200px;height:620px; left:50%;top:50%; margin-left:-600px; margin-top:-310px; } #calculator #c_title{ margin:auto; width:800px; height:80px; margin-left: 150px; } #calculator #c_title h2{ text-align:center; font-size:33px;font-family:微软雅黑;color:#666666; box-shadow: 1px 1px 1px 1px rgba(0, 0, 255, .2); } #calculator #c_text input{ padding-right:20px; margin-left: 50px; width:970px; height:50px; font-size:25px;font-family:微软雅黑;color:#666666; text-align:right; border:double 1px; border:1px solid black; } #calculator #c_value{ widows: 1080px; height:408px; margin:20px auto; } #calculator #c_value ul{ margin:0px; } #calculator #c_value ul li{ margin:10px; list-style:none; float:left; width:180px; height:80px; line-height:80px; text-align:center; background-color:coral; border:0px solid black; font-size:30px; font-family:微软雅黑; color:#666; box-shadow: 12px 12px 2px 1px rgba(0, 0, 255, .2); } #calculator #c_value ul li button{ width: 160px; height:40px; font-size: 20px; } 计算器
2.效果展示
效果如下:
3.总结
由于第一次书写博客,页面过于丑陋,见谅。改demo学会了如何用js实现html计算器,熟悉了js的基础语法及基本使用。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



