主要运用switch case和if else语句对与各按钮各种事件的分类,还有点击事件的运用。
这里先不多说先放代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<style type="text/css">
#box {
width: 500px;
height: 350px;
margin: 0 auto;
background-color: #00aa00;
padding: 30px;
}
#screen {
background-color: white;
background-size: 149.5%;
width: 490px;
height: 70px;
margin: 0px auto;
text-align: right;
line-height: 60px;
color: #000000;
font-size: 28px;
padding-right: 10px;
}
#line {
flex-direction: row;
display: flex;
flex: 1;
}
.item {
text-align: center;
line-height: 60px;
background-color: #008000;
background-size: 600%;
height: 70px;
color: #fff;
font-size: 28px;
flex: 1;
}
.item:active {
background-color: pink;
background-size: 600%;
}
</style>
</head>
<body>
<div id="box">
<div id="screen">0</div>
<div id="line">
<div class&#