Код:
<html>
<head>
<title>mykalkulyator</title>
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body bgcolor="#eeffee" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<div align="center">
<h1>JAVASCRIPT</h1></div>
<hr width="95%" align=center>
<p><div align="center">
<table border="1" bgcolor="#ababab">
<tr>
<td>
<div align="center">
<form name="f1">
<input type="text" name="okno" size="12" value="">
</form></div>
<table width="40%" border="1" cellspacing="0" cellpadding="8" bgcolor="#aa#ffff00">
<tr>
<td >
<div align="center"> <input type="button" value="..1.." onClick="outok('1')"></div>
</td>
<td >
<div align="center"><input type="button" value="..2.." onClick="outok('2')"></div>
</td>
<td >
<div align="center"><input type="button" value="..3.." onClick="outok('3')"></div>
</td>
<td >
<div align="center"><input type="button" value="..- .." onClick="znak(1)"></div>
</td>
<td >
<div align="center"><input type="button" value=".CE." onClick="clearall( )"></div>
</td>
<td >
<div align="center"><input type="button" value="..C.." onClick="clearbufer( )"></div>
</td>
</tr>
<tr>
<td >
<div align="center"><input type="button" value="..4.." onClick="outok('4')"></div>
</td>
<td >
<div align="center"><input type="button" value="..5.." onClick="outok('5')"></div>
</td>
<td >
<div align="center"><input type="button" value="..6.." onClick="outok('6')"></div>
</td>
<td >
<div align="center"><input type="button" value="..+.." onClick="znak(2)"></div>
</td>
<!-- Row 2 Column 5 -->
<td >
<div align="center"><input type="button" value=" - " onClick="outok('-')"></div>
</td>
<!-- Row 2 Column 6 -->
<td >
<div align="center"><input type="button" value=" sqr" onClick="koren( )"></div>
</td>
</tr>
<tr>
<td >
<div align="center"><input type="button" value="..7.." onClick="outok('7')"></div>
</td>
<td >
<div align="center"><input type="button" value="..8.." onClick="outok('8')"></div>
</td>
<td >
<div align="center"><input type="button" value="..9.." onClick="outok('9')"></div>
</td>
<td >
<div align="center"><input type="button" value="..\ .." onClick="znak(3)"></div>
</td>
<!-- Row 3 Column 5 -->
<td >
<div align="center"><input type="button" value=" sin " onClick="sinus( )"></div>
</td>
<!-- Row 3 Column 6 -->
<td >
<div align="center"><input type="button" value="cos" onClick="kosinus( )"></div>
</td>
</tr>
<tr>
<td >
<div align="center"><input type="button" value="( . )" onClick="outok('.')"></div>
</td>
<td >
<div align="center"><input type="button" value="..0.." onClick="outok('0')"></div>
</td>
<td >
<div align="center"><input type="button" value="..=.." onClick="ravno( )"></div>
</td>
<td >
<div align="center"><input type="button" value="..*.." onClick="znak(4)"></div>
</td>
<td >
<div align="center"><input type="button" value=" tan " onClick="tangens( )"></div>
</td>
<td >
<div align="center"><input type="button" value=" ln " onClick="logarifm( )"></div>
</td>
</tr>
</table>
</td>
</tr>
</table></div><br>
<hr width="100%" align=center>
<br>
<script language="JavaScript">
<!-- ;
var a1 = 0 ;
var b1 = 0 ;
var res1 = 0 ;
var ou1 = 0 ;
var ok1 = "" ;
function clearbufer( ) {
document.f1.okno.value="";
b1 = 0 ;
res1 = 0 ;
ok1 = "" ;
}
function clearall( ) {
document.f1.okno.value="" ;
b1 = 0 ;
res1 = 0 ;
a1 = 0 ;
ok1 = "" ;
ou1 = 0
}
function outok(okk) {
ok1 += okk ;
document.f1.okno.value = ok1 ;
}
function znak(ouu) {
ou1 = ouu ;
a1 =eval(document.f1.okno.value) ;
ok1 = "" ;
}
function ravno( ) {
b1 = eval(ok1) ;
if (ou1==1) res1 = a1-b1 ;
if (ou1==2) res1 = a1+b1 ;
if (ou1==3) res1 = a1/b1 ;
if (ou1==4) res1 = a1*b1 ;
document.f1.okno.value = res1 ;
ok1 = "" ;
}
function koren( ) {
var wwws = 0
wwws=eval(document.f1.okno.value) ;
document.f1.okno.value =Math.sqrt(wwws) ;
ok1 = ""
}
function sinus( ) {
var wwws = 0
wwws=eval(document.f1.okno.value) ;
document.f1.okno.value =Math.sin(wwws) ;
ok1 = ""
}
function kosinus( ) {
var wwws = 0
wwws=eval(document.f1.okno.value) ;
document.f1.okno.value =Math.cos(wwws) ;
ok1 = ""
}
function tangens( ) {
var wwws = 0
wwws=eval(document.f1.okno.value) ;
document.f1.okno.value =Math.tan(wwws) ;
ok1 = ""
}
function logarifm( ) {
var wwws = 0
wwws=eval(document.f1.okno.value) ;
document.f1.okno.value =Math.log(wwws) ;
ok1 = ""
}
// end hide -->
</script>
</body>
</html>