რავი გამოგადგებატ. ასე გამოიყურება ->
Code
<html>
<head>
<title>calculator</title>
</head>
<script language="javascript">
operand=0;
function a()
{
document.f1.a1.value=document.f1.a1.value+"1";
}
function b()
{
document.f1.a1.value=document.f1.a1.value+"2";
}
function c()
{
document.f1.a1.value=document.f1.a1.value+"3";
}
function d()
{
document.f1.a1.value=document.f1.a1.value+"4";
}
function e()
{
document.f1.a1.value=document.f1.a1.value+"5";
}
function f()
{
document.f1.a1.value=document.f1.a1.value+"6";
}
function g()
{
document.f1.a1.value=document.f1.a1.value+"7";
}
function h()
{
document.f1.a1.value=document.f1.a1.value+"8";
}
function i()
{
document.f1.a1.value=document.f1.a1.value+"9";
}
function j()
{
document.f1.a1.value=document.f1.a1.value+"0";
}
function k()
{
//document.f1.a1.value=document.f1.a1.value+"+";
moq=h;
operandi1=document.f1.a1.value;
document.f1.a1.value="";
}
function l()
{
//document.f1.a1.value=document.f1.a1.value+"-";
moq=g;
operandi1=document.f1.a1.value;
document.f1.a1.value="";
}
function m()
{
//document.f1.a1.value=document.f1.a1.value+"=";
if(moq==h)
{
shedegi=parseInt(operandi1)+parseInt(document.f1.a1.value);
document.f1.a1.value=shedegi;
}
if(moq==g)
{
shedegi=parseInt(operandi1)-parseInt(document.f1.a1.value);
document.f1.a1.value=shedegi;
}
if(moq==j)
{
shedegi=parseInt(operandi1)/parseInt(document.f1.a1.value);
document.f1.a1.value=shedegi;
}
if(moq==k)
{
shedegi=parseInt(operandi1)*parseInt(document.f1.a1.value);
document.f1.a1.value=shedegi;
}
}
function n()
{
//document.f1.a1.value=document.f1.a1.value+"/";
moq=j;
operandi1=document.f1.a1.value;
document.f1.a1.value="";
}
function o()
{
//document.f1.a1.value=document.f1.a1.value+"x";
moq=k;
operandi1=document.f1.a1.value;
document.f1.a1.value="";
}
</script>
<body>
<form name="f1" action="" method="get" function>
<table border="3" bgcolor="#000000" bordercolor="#878787">
<tr>
<td><center>KRITIKOSI</center></td>
</tr>
<tr>
<td>
<input type="text" name="a1" value="">
</td>
</tr>
<tr>
<td>
<input type="button" value="1" onclick="a();">
<input type="button" value="2" onclick="b();">
<input type="button" value="3" onclick="c();">
<input type="reset" value="clear">
</td>
</tr>
<br />
<tr>
<td>
<input type="button" value="4" onclick="d();">
<input type="button" value="5" onclick="e();">
<input type="button" value="6" onclick="f();">
</td>
</tr>
<tr >
<td>
<input type="button" value="7" onclick="g();">
<input type="button" value="8" onclick="h();">
<input type="button" value="9" onclick="i();">
</td>
</tr>
<tr>
<td>
<input type="button" value="0" onclick="j();">
<input type="button" value="+" onclick="k();">
<input type="button" value="-" onclick="l();">
</td>
</tr>
<tr>
<td>
<input type="button" value="=" onclick="m();">
<input type="button" value="/" onclick="n();">
<input type="button" value="x" onclick="o();">
</td>
</tr>
<table>
</form>
</body>
</html>