<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>计算器</title>
</head>
<body>
<!--定义按键表格,每个按键对应一个事件触发-->
<table border="1" align="center" bgcolor="darkgrey" style="height: 400px; width: 350px">
<!--
描述:align="center" 居中
bgcolor 背景颜色 -->
<tr>
<td colspan="5"> <!-- colspan 跨列数 如0键占横着的两格 rowspan 跨行数 如=键占竖着的两格 -->
<input type="text" id="nummessege" style="height: 40px; width: 400px; font-size: 50px" />
</td>
</tr>
<tr>
<td>
<input type="button" value="MC" id="MC" οnclick="onclicknum('MC')" style="height: 60px; width: 70px; font-size: 25px">
</td>
<td>
<input type="button" value="MR" id="MR" οnclick="onclicknum('MR')" style="height: 60px; width: 70px; font-size: 25px">
</td>
<td>
<input type="button" value="MS" id="MS" οnclick="onclicknum('MS')" style="height: 60px; width: 70px; font-size: 25px">
</td>
<td>
<input type="button" value="M+" id="M+" οnclick="onclicknum('M+')" style="height: 60px; width: 70px; font-size: 25px">
</td>
<td>
<input type="button" value="M-" id="M-" οnclick="onclicknum('M-')" style="height: 60px; width: 70px; font-size: 25px">
</td>
</tr>
<tr>
<td>
<input type="button" value="←" id="←" οnclick="onclicknum('←')" style="height: 60px; width: 70px; font-size: 25px">
</td>
<td>
<input type="button" value="CE" id="CE" οnclick="onclicknum('CE')" style="height: 60px; width: 70px; font-size: 25px">
</td>
<td>
<input type="button" value="C" id="C" οnclick="onclicknum('C')" style="height: 60px; width: 70px; font-size: 25px">
</td>
<td>
<input type="button" value="±" id="±" οnclick="onclicknum('±')" style="height: 60px; width: 70px; font-size: 25px">
</td>
<td>
<input type="button" value="√" id="√" οnclick="onclicknum('√')" style="height: 60px; width: 70px; font-size: 25px">
</td>
</tr>
<tr>
<td>
<input type="button" value="7" id="7" οnclick="onclicknum('7')" style="height: 60px; width: 70px; font-size: 25px">
</td>
<td>
<input type="button" value="8" id="8" οnclick="onclicknum('8')" style="height: 60px; width: 70px; font-size: 25px">
</td>
<td>
<input type="button" value="9" id="9" οnclick="onclicknum('9')" style="height: 60px; width: 70px; font-size: 25px">
</td>
<td> <input type="button" value="/" id="/" οnclick="onclicknum('/')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="%" id="%" οnclick="onclicknum('%')" style="height: 60px; width: 70px; font-size: 25px"> </td> </tr> <tr> <td> <input type="button" value="4" id="4" οnclick="onclicknum('4')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="5" id="5" οnclick="onclicknum('5')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="6" id="6" οnclick="onclicknum('6')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="*" id="*" οnclick="onclicknum('*')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="1/x" id="1/x" οnclick="onclicknum('1/x')" style="height: 60px; width: 70px; font-size: 25px"> </td> </tr> <tr> <td> <input type="button" value="1" id="1" οnclick="onclicknum('1')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="2" id="2" οnclick="onclicknum('2')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="3" id="3" οnclick="onclicknum('3')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="-" id="-" οnclick="onclicknum('-')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td rowspan="2"> <input type="button" value="=" id="=" οnclick="onclicknum('=')" style="height: 120px; width: 70px; font-size: 25px"> </td> </tr> <tr> <td colspan="2"> <input type="button" value="0" id="0" οnclick="onclicknum('0')" style="height: 60px; width: 150px; font-size: 25px"> </td> <td> <input type="button" value="." id="." οnclick="onclicknum('.')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="+" id="+" οnclick="onclicknum('+')" style="height: 60px; width: 70px; font-size: 25px"> </td> </tr> </table> </body></html>