重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

js中如何实现计算器功能

这篇文章将为大家详细讲解有关js中如何实现计算器功能,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

创新互联建站专注于江达企业网站建设,成都响应式网站建设,商城网站建设。江达网站建设公司,为江达等地区提供建站服务。全流程按需网站设计,专业设计,全程项目跟踪,创新互联建站专业和态度为您提供的服务

代码如下:

 
 
  
  
  
  
  .box{ 
  width: 400px; 
  height: 450px; 
  margin: 0 auto; 
  background: pink; 
  } 
  .show{ 
  width:100%; 
  height: 100px; 
  line-height: 100px; 
  text-align: right; 
  background: #FFFFFF; 
  border:1px solid #000; 
  } 
  .operate{ 
  width: 100%; 
  height: 250px; 
  margin-top: 50px; 
  } 
  p{ 
  margin-top: 20px; 
  text-align: center; 
  } 
  input{ 
  width: 80px; 
  height: 40px; 
  /*margin-left: 50px;*/ 
  text-align: center; 
  } 
  input:nth-child(5n),input:first-child{ 
  margin-left: 0; 
  } 
  
  
  
  
  
        

                        

    

                        

    

                        

    

                        

    
       
         function num(figure){  //  var figure = figure.toString();    var show = document.getElementById("show");    showNum = show.innerHTML+figure;    show.innerHTML = showNum;   }   function equal(){    document.getElementById("show").innerHTML = eval(document.getElementById("show").innerHTML);    /*var lal = document.getElementById("show").innerHTML;    alert(lal);*/   }    

关于“js中如何实现计算器功能”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


当前标题:js中如何实现计算器功能
当前路径:http://cqcxhl.com/article/gjogsd.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP