|
|
|
@ -0,0 +1,39 @@
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="zh">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
<title>iPhone计算器</title>
|
|
|
|
|
<link rel="stylesheet" href="style.css"> <!-- 引入CSS样式文件 -->
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<div class="calculator">
|
|
|
|
|
<div class="display" id="display">0</div> <!-- 显示区 -->
|
|
|
|
|
<div class="buttons">
|
|
|
|
|
<button class="button function" onclick="clearDisplay()">AC</button>
|
|
|
|
|
<button class="button function" onclick="percent()">%</button>
|
|
|
|
|
<button class="button operator" onclick="setOperation('/')">÷</button>
|
|
|
|
|
<button class="button operator" onclick="setOperation('*')">×</button>
|
|
|
|
|
|
|
|
|
|
<button class="button" onclick="appendNumber(7)">7</button>
|
|
|
|
|
<button class="button" onclick="appendNumber(8)">8</button>
|
|
|
|
|
<button class="button" onclick="appendNumber(9)">9</button>
|
|
|
|
|
<button class="button operator" onclick="setOperation('-')">-</button>
|
|
|
|
|
|
|
|
|
|
<button class="button" onclick="appendNumber(4)">4</button>
|
|
|
|
|
<button class="button" onclick="appendNumber(5)">5</button>
|
|
|
|
|
<button class="button" onclick="appendNumber(6)">6</button>
|
|
|
|
|
<button class="button operator" onclick="setOperation('+')">+</button>
|
|
|
|
|
|
|
|
|
|
<button class="button" onclick="appendNumber(1)">1</button>
|
|
|
|
|
<button class="button" onclick="appendNumber(2)">2</button>
|
|
|
|
|
<button class="button" onclick="appendNumber(3)">3</button>
|
|
|
|
|
<button class="button operator equal" onclick="calculate()">=</button>
|
|
|
|
|
|
|
|
|
|
<button class="button zero" onclick="appendNumber(0)">0</button>
|
|
|
|
|
<button class="button" onclick="appendSymbol('.')">.</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<script src="script.js"></script> <!-- 引入JavaScript文件 -->
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|