使用HTML做一个微行计算器(无计算功能)

<!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" onclick="onclicknum('MC')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
	<td>
		<input type="button" value="MR" id="MR" onclick="onclicknum('MR')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
	<td>
		<input type="button" value="MS" id="MS" onclick="onclicknum('MS')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
	<td>
		<input type="button" value="M+" id="M+" onclick="onclicknum('M+')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
	<td>
		<input type="button" value="M-" id="M-" onclick="onclicknum('M-')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
        </tr> 
	<tr>
	<td>
		<input type="button" value="←" id="←" onclick="onclicknum('←')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
	<td>
		<input type="button" value="CE" id="CE" onclick="onclicknum('CE')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
	<td>
		<input type="button" value="C" id="C" onclick="onclicknum('C')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
	<td>
		<input type="button" value="±" id="±" onclick="onclicknum('±')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
	<td>
		<input type="button" value="√" id="√" onclick="onclicknum('√')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
        </tr>
	<tr>
	<td>
		<input type="button" value="7" id="7" onclick="onclicknum('7')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
	<td>
		<input type="button" value="8" id="8" onclick="onclicknum('8')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
	<td>
		<input type="button" value="9" id="9" onclick="onclicknum('9')" style="height: 60px; width: 70px; font-size: 25px">
	</td>
<td> <input type="button" value="/" id="/" onclick="onclicknum('/')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="%" id="%" onclick="onclicknum('%')" style="height: 60px; width: 70px; font-size: 25px"> </td> </tr> <tr> <td> <input type="button" value="4" id="4" onclick="onclicknum('4')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="5" id="5" onclick="onclicknum('5')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="6" id="6" onclick="onclicknum('6')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="*" id="*" onclick="onclicknum('*')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="1/x" id="1/x" onclick="onclicknum('1/x')" style="height: 60px; width: 70px; font-size: 25px"> </td> </tr> <tr> <td> <input type="button" value="1" id="1" onclick="onclicknum('1')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="2" id="2" onclick="onclicknum('2')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="3" id="3" onclick="onclicknum('3')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="-" id="-" onclick="onclicknum('-')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td rowspan="2"> <input type="button" value="=" id="=" onclick="onclicknum('=')" style="height: 120px; width: 70px; font-size: 25px"> </td> </tr> <tr> <td colspan="2"> <input type="button" value="0" id="0" onclick="onclicknum('0')" style="height: 60px; width: 150px; font-size: 25px"> </td> <td> <input type="button" value="." id="." onclick="onclicknum('.')" style="height: 60px; width: 70px; font-size: 25px"> </td> <td> <input type="button" value="+" id="+" onclick="onclicknum('+')" style="height: 60px; width: 70px; font-size: 25px"> </td> </tr> </table> </body></html>
 
 

猜你喜欢

转载自blog.csdn.net/viczking/article/details/80424970
今日推荐