<!DOCTYPE html PUBLIC "
<html xmlns="
<head>
<meta http
<title>計算器</title>
<script language="javascript" type="text/javascript">
var clearFlag=false;
function getNum(num){
//alert(num);
var objresult=document
if(clearFlag){
objresult
clearFlag=false;
}
//alert(objresult);
objresult
}
function getResult(){
var objresult=document
objresult
clearFlag=true;
}
</script>
</head>
<body>
<table width="
<tr>
<td colspan="
</tr>
<tr>
<td width="
<td width="
<td width="
<td width="
</tr>
<tr>
<td><input type="button" value="
<td><input type="button" value="
<td><input type="button" value="
<td><input type="button" value="
</tr>
<tr>
<td><input type="button" value="
<td><input type="button" value="
<td><input type="button" value="
<td><input type="button" value=" * " onclick="getNum(
</tr>
<tr>
<td><input type="button" value="
<td><input type="button" value="
<td><input type="button" value=" = " onclick="getResult()"></td>
<td><input type="button" value=" / " onclick="getNum(
</tr>
</table>
</body>
</html>
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20138.html