You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Git/final/index.html

40 lines
1.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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>