Здравствуйте! Помогите пожалуйста с вычислением процентов данного калькулятора.
<html>
<head>
<title>Калькулятор</title>
<META http-equiv="Content-Type" content="text/html; charset=windows-1251">
<!-- HEAD START HERE -->
<style type="text/css">
<!--
body {font-family: helvetica}
p {font-size: 14pt}
.p1 {font-size: 20pt}
.red {color: #ff0000}
.blue {color: #082567}
-->
</style>
<!-- HEAD END HERE -->
</head>
<body bgcolor="#faeedd" text="#faeedd" link="#000000" topmargin="0" leftmargin="0">
<center>
<!-- BODY START HERE -->
<FORM name="Keypad" action="">
<!-- Original: [url]http://www.dummyproof.com/javascripts[/url] -->
<table bgcolor="#faeedd" border=0>
<FORM>
<TR>
<TD colSpan=5>
<tr><td>
<tr><td colspan=6><input type="text" class="p1 red" name="display"style="height:50;TEXT-ALIGN: right"style="transform: scaleY(-66sy);font-size: 250%" size=13 maxlength=30 onChange="CheckNumber(this.value) onkeyup="numbers(this);" ></td></tr>
<tr><td colspan=6>
<table border=0 cellpadding=0>
<TR>
<TD>
<input style="height:30;width:35" type="button" class="p red" value="←" onClick="deleteChar(this.form.display)">
<input style="height:30;width:35" type="Button" class="p" value="C" onClick="this.form.display.value = 0 ">
<input style="height:30;width:35" type="Button" class="p" value="CE" onClick="this.form.display.value = ">
<input style="height:30;width:35" type="Button" class="p" value="±" onClick="changeSign(this.form.display)">
<input style="height:30;width:35" type="button" class="p" value="√" onClick="if (checkNum(this.form.display.value)) {
sqrt(this.form) }">
</TD>
</TR>
</table>
<table border=0 cellpadding=0>
<TR>
<TD>
<input style="height:30;width:35" type="Button" class="p" value="7" onClick="addChar(this.form.display, '7')">
<input style="height:30;width:35" type="Button" value="8" onClick="addChar(this.form.display, '8')">
<input style="height:30;width:35" type="Button" value="9" onClick="addChar(this.form.display, '9')">
<input style="height:30;width:35" type="Button" class="red" value="/" onClick="addChar(this.form.display, '/')">
<input style="height:30;width:35" type="Button" class="p" value="%" onclick="Percent()">
</TD>
</TR>
</table>
<table border=0 cellpadding=0>
<TR>
<TD>
<input style="height:30;width:35" type="Button" value="4" onClick="addChar(this.form.display, '4')">
<input style="height:30;width:35" type="Button" value="5" onClick="addChar(this.form.display, '5')">
<input style="height:30;width:35" type="Button" value="6" onClick="addChar(this.form.display, '6')">
<input style="height:30;width:35" type="Button" class="red" value="*" onClick="addChar(this.form.display, '*')">
</TD>
</TR>
</table>
<table border=0 cellpadding=0>
<TR>
<TD>
<input style="height:30;width:35" type="Button" value="1" onClick="addChar(this.form.display, '1')">
<input style="height:30;width:35" type="Button" value="2" onClick="addChar(this.form.display, '2')">
<input style="height:30;width:35" type="Button" value="3" onClick="addChar(this.form.display, '3')">
<input style="height:30;width:35" type="Button" class="red" value="+" onClick="addChar(this.form.display, '+')">
<input style="height:30;width:35" type="Button" class="red" value="-" onClick="addChar(this.form.display, '-')">
</TD>
</TR>
</table>
<table border=0 cellpadding=0>
<TR>
<TD>
<input style="height:30;width:35" type="Button" value="0" onClick="addChar(this.form.display, '0')">
<input style="height:30;width:35" type="Button" value="00" onClick="addChar(this.form.display, '00')">
<input style="height:30;width:35" type="Button" value="•" onClick="addChar(this.form.display, '.')">
<input style="height:30;width:74" type="Button" class="red" value="⚌" onClick="if (checkNum(this.form.display.value)) {
compute(this.form) }">
<input type="button" value="SM" onclick=l=display.value;display.focus()>
<input type="button" value="LM" value="+" onclick=display.value=display.value+l;display.focus()>
</TD>
</TR>
</TABLE>
</TABLE>
</TABLE>
</table>
</FORM>
</FORM>
</CENTER>
<font face="Verdana, Arial, Helvetica" size=2>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var FKeyPad = document.Keypad;
var Accum = 0;
var FlagNewNum = false;
var PendingOp = "";
function addChar(input, character) {
if(input.value == null || input.value == "0")
input.value = character
else
input.value += character
}
function cos(form) {
form.display.value = Math.cos(form.display.value);}
function sin(form) {
form.display.value = Math.sin(form.display.value);}
function tan(form) {
form.display.value = Math.tan(form.display.value);}
function sqrt(form) {
form.display.value = Math.sqrt(form.display.value);}
function ln(form) {
form.display.value = Math.log(form.display.value);}
function exp(form) {
form.display.value = Math.exp(form.display.value);}
function sqrt(form) {
form.display.value = Math.sqrt(form.display.value);}
function deleteChar(input) {
input.value = input.value.substring(0, input.value.length - 1)
}
function changeSign(input) {
if(input.value.substring(0, 1) == "-")
input.value = input.value.substring(1, input.value.length)
else
input.value = "-" + input.value
}
function compute(form) {
form.display.value = eval(form.display.value)}
function square(form) {
form.display.value = eval(form.display.value) *
eval(form.display.value)}
function checkNum(str) {
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i+1)
if (ch < "0" || ch > "9") {
if (ch != "/" && ch != "*" && ch != "+" && ch !=
"-" && ch != "."
&& ch != "(" && ch!= ")") {
alert("invalid entry!")
return false
}
}
}
return true
}
function Percent () {
form.display.value = (checkNum(form.display.value) / 100) * checkNum(character);
}
// End -->
</SCRIPT>
<!-- BODY END HERE -->
</body>
</html>