今天就跟大家聊聊有關(guān)使用JS實(shí)現(xiàn)多功能計(jì)算器,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

compute.html:
<!--
* @Author: CSU_XZY
* @Date: 2020-10-15 21:17:33
* @LastEditors: CSU_XZY
* @LastEditTime: 2020-10-16 22:07:08
* @FilePath: \第二天\計(jì)算器\compute.html
* @Description: just to play
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>計(jì)算器</title>
</head>
<style>
*{
margin: 0;
padding: 0;
}
body{
background-color: #FCFDFE;
}
.container{
overflow: hidden;
box-shadow: 0 0 3px 0 rgba(0, 0, 0, .3);
margin: 150px auto;
width: 548px;
height: 274px;
background-color: #fff;
}
.box{
background-color: #fcfdff;
margin: 15px auto;
overflow: hidden;
width: 514px;
height: 244px;
}
.number{
width: 514px;
height: 189px;
}
.text{
width: 514px;
height: 55px;
margin: 0;
}
span{
border-top: solid 1px #ebebeb;
border-right: solid 1px #ebebeb;
box-sizing: border-box;
float: left;
display: block;
width: 25%;
font-size: 16px;
color: #333;
background-color: #fff;
line-height: 37px;
cursor: pointer;
text-align: center;
font-weight: 10px;
}
span:hover{
background-color: #d3d7d4;
}
span:active{
background-color: #afdfe4;
}
.text>p{
text-align: right;
width: 514px;
height: 24px;
line-height: 25px;
font-size: 25px;
}
.number>div{
width: 514px;
height: 37.8px;
}
.around{
background-color: #f9f9f9;
color: #f60;
}
.compute{
color: #333;
}
.bottom{
background-color: #fff;
color: #f60;
}
.dot{
font-size: 23px;
font-weight: 19px;
}
</style>
<body>
<div class="container">
<div class="box">
<div class="text">
<p id="text"></p>
<p id="display"></p>
</div>
<div class="number">
<div class="around">
<span onclick="showDetails(this)" data-value="(" class="around">(</span>
<span onclick="showDetails(this)" data-value=")" class="around">)</span>
<span onclick="showDetails(this)" data-value="D" title="回退一位數(shù)" class="around">del</span>
<span onclick="showDetails(this)" data-value="C" class="around compute">C</span>
</div>
<div>
<span onclick="showDetails(this)" data-value="7">7</span>
<span onclick="showDetails(this)" data-value="8">8</span>
<span onclick="showDetails(this)" data-value="9">9</span>
<span onclick="showDetails(this)" data-value="÷" class="around">÷</span>
</div>
<div>
<span onclick="showDetails(this)" data-value="4">4</span>
<span onclick="showDetails(this)" data-value="5">5</span>
<span onclick="showDetails(this)" data-value="6">6</span>
<span onclick="showDetails(this)" data-value="x" class="around">x</span>
</div>
<div>
<span onclick="showDetails(this)" data-value="1">1</span>
<span onclick="showDetails(this)" data-value="2">2</span>
<span onclick="showDetails(this)" data-value="3">3</span>
<span onclick="showDetails(this)" data-value="-" class="around">-</span>
</div>
<div>
<span onclick="showDetails(this)" data-value="0">0</span>
<span onclick="showDetails(this)" data-value="." class="around bottom dot">.</span>
<span onclick="showDetails(this)" data-value="=" class="around bottom">=</span>
<span onclick="showDetails(this)" data-value="+" class="around">+</span>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="compute.js"></script>
</html>
網(wǎng)頁(yè)題目:使用JS實(shí)現(xiàn)多功能計(jì)算器-創(chuàng)新互聯(lián)
轉(zhuǎn)載來(lái)于:http://chinadenli.net/article12/epcgc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、App開(kāi)發(fā)、品牌網(wǎng)站制作、靜態(tài)網(wǎng)站、網(wǎng)站內(nèi)鏈、App設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容