SOURCE

console 命令行工具 X clear

                    
>
console
/* 初步化显示 */ 
document.getElementById("clear").addEventListener("click", function() {
	document.getElementById("display").value = "";
});
/* 接收值 */
function get(value) {
	document.getElementById("display").value += value; 
} 

/* 计算 */
function calculates() {
	var result = 0;
	result = document.getElementById("display").value;
	document.getElementById("display").value = "";
	document.getElementById("display").value = eval(result);
};
<!DOCTYPE html>
<html>
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JavaScript 弹窗</title> 
<link rel="stylesheet" type="text/css" href="jsq.css" />
<script type="text/javascript" src="jsq.js"></script>
</head>
<body>
    <div class="center">
        <h1>HTML CSS, JavaScript 计算器</h1>
          <form name="calculator">
          <input type="button" id="clear" class="btn other" value="C">
          <input type="text" id="display">
            <br>
          <input type="button" class="btn number" value="7" onclick="get(this.value);">
          <input type="button" class="btn number" value="8" onclick="get(this.value);">
          <input type="button" class="btn number" value="9" onclick="get(this.value);">
          <input type="button" class="btn operator" value="+" onclick="get(this.value);">
            <br>
          <input type="button" class="btn number" value="4" onclick="get(this.value);">
          <input type="button" class="btn number" value="5" onclick="get(this.value);">
          <input type="button" class="btn number" value="6" onclick="get(this.value);">
          <input type="button" class="btn operator" value="*" onclick="get(this.value);">
            <br>
          <input type="button" class="btn number" value="1" onclick="get(this.value);">
          <input type="button" class="btn number" value="2" onclick="get(this.value);">
          <input type="button" class="btn number" value="3" onclick="get(this.value);">
          <input type="button" class="btn operator" value="-" onclick="get(this.value);">
            <br>
          <input type="button" class="btn number" value="0" onclick="get(this.value);">
          <input type="button" class="btn operator" value="." onclick="get(this.value);">
          <input type="button" class="btn operator" value="/" onclick="get(this.value);">			
          <input type="button" class="btn other" value="=" onclick="calculates();">
        </form>
      </div>
</body>
</html>
/* Basic Reset */
* {
	border: none;
	font-family: 'Open Sans', sans-serif;
	margin: 0;
	padding: 0;
}
.center {
	background-color: #fff;
	border-radius: 50%;
	height: 600px;
	margin: auto;
	width: 600px;
}
h1 {
	color: #ff0f0f;
	font-size: 30px;	
	margin-top: 20px;
	padding-top: 50px;
	display: block;
	text-align: center;
	text-decoration: none;
}
a {
	color: #495678;
	font-size: 30px;	
	display: block;
	text-align: center;
	text-decoration: none;
	padding-top: 20px;
}
form {
	background-color: #824799;
	box-shadow: 4px 4px #3d4a65;
	margin: 40px auto;
	padding: 40px 0 30px 40px;	
	width: 280px;
}
.btn {
	outline: none;
	cursor: pointer;
	font-size: 20px;
	height: 45px;
	margin: 5px 0 5px 10px;
	width: 50px;
}
.btn:first-child {
	margin: 5px 0 5px 10px;
}
.btn, #display, form {
	border-radius: 500px;
}
#display {
	outline: none;
	background-color: #98d1dc;
	box-shadow: inset 6px 6px 0px #3facc0;
	color: #dededc;
	font-size: 20px;
	height: 47px;
	text-align: right;
	width: 165px;
	padding-right: 10px;
	margin-left: 10px;
}
.number {
	background-color: #f36608;
	box-shadow: 0 5px #b9dd17;
	color: #dededc;
}
.number:active {
	box-shadow: 0 2px #d158f0;
  	-webkit-transform: translateY(2px);
  	-ms-transform: translateY(2px);
  	-moz-tranform: translateY(2px);
  	transform: translateY(2px);
}
.operator {
	background-color: #2b09ecbe;
	box-shadow: 0 5px #d306fc;
	color: #c4e940;
}
.operator:active {
	box-shadow: 0 2px #ad54e0;
  	-webkit-transform: translateY(2px);
  	-ms-transform: translateY(2px);
  	-moz-tranform: translateY(2px);
  	transform: translateY(2px);
}
.other {
	background-color: #0af350;
	box-shadow: 0 5px #0dc4fc;
	color: #dededc;
}
.other:active {
	box-shadow: 0 2px #e76a3d;
  	-webkit-transform: translateY(2px);
  	-ms-transform: translateY(2px);
  	-moz-tranform: translateY(2px);
  	transform: translateY(2px);
}