<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
<table align="center" bgcolor="#7f84b9">
<tr align="center">
<td><input type="text" id="text"
style="width: 98%; height: 20px"><br></td>
</tr>
<tr align="center">
<td><input type="button"
style="width: 49%; height: 30px; background-color: #b8a0c8;"
value="clear" onclick="btnclear()"> <input type="button"
onclick="btncal()"
style="width: 49%; height: 30px; background-color: #b8a0c8;"
value="="></td>
</tr>
<tr align="center">
<td><input type="button" onclick="btn(1)"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="1"> <input type="button" onclick="btn(2)"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="2"> <input type="button" onclick="btn(3)"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="3"> <input type="button" onclick="btnop('+')"
style="width: 70px; height: 40px; background-color: #b8a0c8;"
value="+"> <input type="button" onclick="btnpow()"
style="width: 70px; height: 40px; background-color: #b8a0c8;"
value="x^y"></td>
</tr>
<tr align="center">
<td><input type="button" onclick="btn(4)"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="4"> <input type="button" onclick="btn(5)"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="5"> <input type="button" onclick="btn(6)"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="6"> <input type="button" onclick="btnop('-')"
style="width: 70px; height: 40px; background-color: #b8a0c8;"
value="-"> <input type="button" onclick="btnsin()"
style="width: 70px; height: 40px; background-color: #b8a0c8;"
value="sin"></td>
</tr>
<tr align="center">
<td><input type="button" onclick="btn(7)"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="7"> <input type="button" onclick="btn(8)"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="8"> <input type="button" onclick="btn(9)"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="9"> <input type="button" onclick="btnop('*')"
style="width: 70px; height: 40px; background-color: #b8a0c8;"
value="*"> <input type="button" onclick="btncos()"
style="width: 70px; height: 40px; background-color: #b8a0c8;"
value="cos"></td>
</tr>
<tr align="center">
<td><input type="button" onclick="btn(0)"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="0"> <input type="button" onclick="btnabs()"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="+/-"> <input type="button" onclick="btn('.')"
style="width: 70px; height: 40px; background-color: #f2bdd0;"
value="."> <input type="button" onclick="btnop('/')"
style="width: 70px; height: 40px; background-color: #b8a0c8;"
value="/"> <input type="button" onclick="btntan()"
style="width: 70px; height: 40px; background-color: #b8a0c8;"
value="tan"></td>
</tr>
</table>
<script type="text/javascript">
var total='';
function btn(num)
{
total+=num;
document.getElementById("text").value+=num;
}
function btnclear(){
document.getElementById("text").value="";
total='';
}
function btncal()
{
document.getElementById("text").value=eval(total);
}
function btnop(num)
{
total+=num;
document.getElementById("text").value="";
}
function btnpow()
{
total=Math.pow(total,2);
document.getElementById("text").value=total;
}
function btnsin()
{
total=Math.sin(total*(Math.PI/180));
document.getElementById("text").value=total;
}
function btncos()
{
total=Math.cos(total*(Math.PI/180));
document.getElementById("text").value=total;
}
function btntan()
{
total=Math.tan(total*(Math.PI/180));
document.getElementById("text").value=total;
}
function btnabs()
{
total=total*-1;
document.getElementById("text").value=total;
}
</script>
</body>
</html>