Официальный Форум технической поддержки сервиса ForumBB

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.



Калькулятор не найден

Сообщений 1 страница 2 из 2

1

Здраствуйте. У меня есть такая проблема - пытаюсь найти какой-либо скрипт для своего форума, однако не получается найти подходящих вариантов.

Калькулятор1

Этот калькулятор решает квадратные уравнения. Если кому захочется его проверить, то:

Код:
<html>
<head>
<title>IDV Kvadur v1.0 by idv-Studio.ru</title>
<meta http-equiv='content-type' content='text/html' charset='windows-1251'>
<style type='text/css'>
.idv_1 {border-collapse: collapse; border: 1px solid black}
table.idv_1 * {font-size: 10px; font-family: Verdana}
.idv_2 {border: #000 1px solid; color: #fff; padding: 2px}
a.idv_3:link, a.idv_3:visited, a.idv_3:active {color: #fff; text-decoration: none}
.idv_4 {border-left: 1px #000 solid; border-right: 1px #000 solid; padding: 3px 10px 2px 8px}
td.idv_4 * {vertical-align: middle}
.idv_5 {width: 35pt}
.idv_6 {border-left: 1px #000 solid; border-right: 1px #000 solid}
.idv_7 {margin: 0 8px; _height: 60px; min-height: 60px; background: #fff; border: 1px solid black; padding: 2px}
.idv_8 {border: 1px #000 solid; border-top: 0; padding: 4px 0px 2px 9px}
.idv_9 {background: #0066cc; border: 0; color: #fff}
#D {text-decoration: overline}
#BB {border-bottom: #000 1px solid}
</style>
</head>
<body>
<script language='JavaScript'>
var d = document;
function Kvadur() {
var m = Math;
var a = d.getElementById('a').value;
var b = d.getElementById('b').value;
var c = d.getElementById('c').value;
if (a == 0) a = 1;
if (b == 0) b = 1;
if (c == 0) c = 1;
var su = amn = k4 = od = solution = '';  
var bmn = cmn = dmn = '+ ';
if (a < 0) amn = '-';
if (b < 0) bmn = '- ';
if (c < 0) cmn = '- ';
if (-4*a*c < 0) dmn = '- ';
if (a < 0 && b < 0 && c < 0) {
for (var i = m.min(a, b, c); i < -1; ++i) {
if (a % i == 0 && b % i == 0 && c % i == 0) break;
  }
} else
for (var i = m.max(a, b, c); i > 1; --i) {
if (a % i == 0 && b % i == 0 && c % i == 0) break;
}
if (m.abs(i) != 1) {
var a = a/i; var b = b/i; var c = c/i;
var as = ''; var bs = cs = '+ ';
if (a < 0) as = '-';
if (b < 0) bs = '- ';
if (c < 0) cs = '- ';
if (i < 0) {
as = ''; bs = '+ '; cs = '+ ';
}
var su = '<br>Делим на '+i+':<br>'+as+m.abs(a)+'x<sup>2</sup> '+bs+m.abs(b)+'x '+cs+m.abs(c)+' = 0';
if (m.abs(a) == 1)  
var su = '<br>Делим на '+i+':<br>'+as+'x<sup>2</sup> '+bs+m.abs(b)+'x '+cs+m.abs(c)+' = 0';
if (m.abs(b) == 1)
var su = '<br>Делим на '+i+':<br>'+as+m.abs(a)+'x<sup>2</sup> '+bs+'x '+cs+m.abs(c)+' = 0';
if (m.abs(a) == 1 && m.abs(b) == 1)
var su = '<br>Делим на '+i+':<br>'+as+'x<sup>2</sup> '+bs+'x '+cs+m.abs(c)+' = 0';
}
var tb1 = '<table><tr><td rowspan=2 style=\'padding-top: 2pt\'>';
var tb2 = '</td><td id=BB align=center>';
var tb3 = '</td></tr><tr><td align=center>';
var tb4 = '</td></tr></table>';
var tb1_ = '<table><tr><td rowspan=2>';
var tb_ = '<td rowspan=2 style=\'padding-bottom: 2pt\'>';
if ((b*b-4*a*c) < 0) {
var k4 = 'i'; var od = '-';
}
var equation = amn+m.abs(a*i)+'x<sup>2</sup> '+bmn+m.abs(b*i)+'x '+cmn+m.abs(c*i)+' = 0'+su;
var D = m.abs(b*b-4*a*c);
var Dis = 'D = b<sup>2</sup> - 4ac<br>D = '+b*b+' '+dmn+m.abs(4*a*c)+' = '+od+D;
var x1 = eval((-b+m.sqrt(D))/(2*a));
var X1 = '</span>'+tb1+'x<sub>1,2</sub> ='+tb2+'-b ± √<span id=D>D</span>'+tb3+'2a'+tb4+tb1+'x<sub>1</sub> ='+tb2+-b+' + ';
var x2 = eval((-b-m.sqrt(D))/(2*a));
var X2 = tb1+'x<sub>2</sub> ='+tb2+-b+' - ';
var kd = k4+'√<span id=D>'+D+'</span>';
var result = d.getElementById('result');
if (m.abs(a) == 1 && m.abs(i) == 1)
equation = amn+'x<sup>2</sup> '+bmn+m.abs(b)+'x '+cmn+m.abs(c)+' = 0';
if (m.abs(b) == 1 && m.abs(i) == 1)
equation = amn+m.abs(a)+'x<sup>2</sup> '+bmn+'x '+cmn+m.abs(c)+' = 0';
if (m.abs(a) == 1 && m.abs(b) == 1 && m.abs(i) == 1)
equation = amn+'x<sup>2</sup> '+bmn+'x '+cmn+m.abs(c)+' = 0';
if (D == 0) {
var mux = '';
if ((-b < 0 && a > 0) || (-b > 0 && a < 0)) mux = '-';
for (var DN = m.max(-b, 2*a); DN > 1; --DN) {
if (-b % DN == 0 && 2*a % DN == 0) break;
}
var exc = mux+tb2+m.abs(-b/DN)+tb3+m.abs(2*a)+'</td><td rowspan=2>'+m.abs((2*a)/DN);
if (-b/(2*a) == m.floor(-b/(2*a))) {
var exc = ' </td>'+tb_+-b/(2*a)+tb3+m.abs(2*a);
}
var AnS = '<table><tr>'+tb_+'Ответ: x = '+mux+tb2+m.abs(b/DN)+tb3+m.abs((2*a)/DN)+tb4;
if (-b/(2*a) == m.floor(-b/(2*a)) || d.getElementById('iz').checked)
var AnS = 'Ответ: x = '+-b/(2*a);
var x = '<table><tr>'+tb_+'x = - '+tb2+'b'+tb3+'2a'+tb4+'<table><tr>'+tb_+'x = '+mux+tb2+m.abs(b)+'</td>'+tb_+' = '+exc+tb4;
var solution = equation+'<br>'+Dis+'<br>'+x+AnS;
}
if (D != 0) {
for (var j = m.floor(m.sqrt(D)); j > 0; --j) {
if ((b*b-4*a*c) < 0 && !d.getElementById('i').checked) {
var solution = equation+'<br>'+Dis+' < 0<br>Ответ: нет решений</span>'; break;
}
if ((b*b-4*a*c) > 0 && D%(j*j) == 0 && D/(j*j) == 1) {
var ch1 = ch2 = zn1 = zn2 = mud1 = mud2 = '';
var exc1 = tb_+x1+tb3+2*a+'</td><td align=center>'+m.abs(2*a)+'</td>';
var exc2 = tb_+x2+tb3+2*a+'</td><td align=center>'+m.abs(2*a)+'</td>';
if ((eval(-b+j) < 0 && a > 0) || (eval(-b+j) > 0 && a < 0)) mud1 = '-';
if (((-b-j) < 0 && a > 0) || ((-b-j) > 0 && a < 0)) mud2 = '-';
for (var lm = m.max((-b-j), 2*a); lm > 1; --lm) {
if ((-b-j) % lm == 0 && 2*a % lm == 0) break;
}
for (var lp = m.max((-b+j), 2*a); lp > 1; --lp) {
if ((-b+j) % lp == 0 && 2*a % lp == 0) break;
}
if (x2 != m.floor(x2)) {
var ch1 = m.abs((-b-j)/lm);
var zn1 = m.abs((2*a)/lm);
var exc2 = mud2+'<td id=BB align=center>'+ch1+tb3+2*a+'</td><td align=center>'+m.abs(2*a)+'</td><td align=center>'+zn1;
}
if (x1 != m.floor(x1)) {
var ch2 = m.abs((-b+j)/lp);
var zn2 = m.abs((2*a)/lp);
var exc1 = mud1+'<td id=BB align=center>'+ch2+tb3+2*a+'</td><td align=center>'+m.abs(2*a)+'</td><td align=center>'+zn2;
}
var ans = tb1+'Ответ: x<sub>1</sub> = '+mud1+tb2+ch2+'</td><td rowspan=2 style=\'padding-top: 2pt\'>; x<sub>2</sub> = '+mud2+tb2+ch1+'</td></tr><tr><td>'+zn2+'</td><td>'+zn1+tb4;
if (x2 == m.floor(x2) && x1 != m.floor(x1)) {
var ans = tb1+'Ответ: x<sub>1</sub> = '+mud1+tb2+ch2+'</td><td rowspan=2 style=\'padding-top: 2pt\'>; x<sub>2</sub> = </td>'+tb_+x2+'</td></tr><tr><td>'+zn2+tb4;
}
if (x2 != m.floor(x2) && x1 == m.floor(x1)) {
var ans = tb1+'Ответ: x<sub>1</sub> = </td>'+tb_+x1+'</td><td rowspan=2 style=\'padding-top: 2pt\'>; x<sub>2</sub> = '+mud2+tb2+ch1+'</td></tr><tr><td>'+zn1+tb4;
}
if ((x1 == m.floor(x1) && x2 == m.floor(x2)) || d.getElementById('iz').checked) {
var ans = 'Ответ: x<sub>1</sub> = '+x1+'; x<sub>2</sub> = '+x2;
}
var d1 = ' = '+j+'<sup>2</sup>';
if (D == 1) var d1 = '';
var solution = equation+'<br>'+Dis+d1+'<br>'+X1+j+'</td><td rowspan=2  style=\'padding-bottom: 2pt\'>= '+mud1+tb2+m.abs(-b+j)+'</td>'+tb_+'= '+exc1+tb4+X2+j+'</td><td rowspan=2  style=\'padding-bottom: 2pt\'>= '+mud2+tb2+m.abs(-b-j)+'</td>'+tb_+'= '+exc2+tb4+ans; break;
}
if (D%(j*j) == 0) {
for (var k = m.max(-b, j, 2*a); k > 1; --k) {
if (-b % k == 0 && j % k == 0 && 2*a % k == 0) break;
}
var kid = k4+'√<span id=D>'+D/(j*j)+'</span>';
if ((b*b-4*a*c) < 0 && D%(j*j) == 0 && D/(j*j) == 1 && d.getElementById('i').checked) var kid = k4;
var sx1 = sx2 = '';
var jk = j/k;
if (j == 1) j = '';
var answer = tb1+'Ответ: x<sub>1</sub> = '+tb2+-b+' + '+j+kid+'</td><td rowspan=2 style=\'padding-bottom: 3pt\'>'+tb1+'; x<sub>2</sub> = '+tb2+-b+' - '+j+kid+tb3+2*a+tb4+tb3+2*a+tb4;
if (jk == 1) jk = '';
if (m.abs(k) != 1) {
var sx1 = tb1_+' = '+tb2+-b/k+' + '+jk+kid+tb3+2*a/k+tb4;
var sx2 = tb1_+' = '+tb2+-b/k+' - '+jk+kid+tb3+2*a/k+tb4;
if (2*a/k == 1) {
var sx1 = ' = '+-b/k+' + '+jk+kid;
var sx2 = ' = '+-b/k+' - '+jk+kid;
}
if (2*a/k == -1) {
var sx1 = ' = '+b/k+' - '+jk+kid;
var sx2 = ' = '+b/k+' + '+jk+kid;
}
var answer = '<table><tr><td style=\'padding-top: 4pt\'>Ответ: x<sub>1</sub></td><td>'+sx1+'</td><td style=\'padding-top: 4pt\'>; x<sub>2</sub></td><td>'+sx2+tb4;
}
if ((b*b-4*a*c) > 0 && d.getElementById('iz').checked)
var answer = 'Ответ: x<sub>1</sub> = '+x1+'; x<sub>2</sub> = '+x2;
var solution = equation+'<br>'+Dis+' = ('+j+kid+')<sup>2</sup><br>'+X1+j+kid+'</td><td rowspan=2 style=\'padding-top: 1pt\'>'+sx1+tb3+2*a+tb4+X2+j+kid+'</td><td rowspan=2 style=\'padding-top: 1pt\'>'+sx2+tb3+2*a+tb4+answer; break;
}
if (j == 2) {
var ANS = tb1+'Ответ: x<sub>1</sub> = '+tb2+-b+' + '+kd+'</td><td rowspan=2 style=\'padding-top: 3pt\'>; x<sub>2</sub> = '+tb2+-b+' - '+kd+tb3+2*a+'</td><td align=center>'+2*a+tb4;
if ((b*b-4*a*c) > 0 && d.getElementById('iz').checked)
var ANS = 'Ответ: x<sub>1</sub> = '+x1+'; x<sub>2</sub> = '+x2;
var solution = equation+'<br>'+Dis+' = ('+kd+')<sup>2</sup><br>'+X1+kd+tb3+2*a+tb4+X2+kd+tb3+2*a+tb4+ANS; break;
     }
   }
}
result.innerHTML = solution;
d.getElementById('html').value = '<style type=\'text/css\'>#idv * {font-size: 10px; font-family: Verdana} #D {text-decoration: overline} #BB {border-bottom: #000 1px solid}</style><div id=idv><span>'+solution+'</div>';
}
function Addition() {
if (d.getElementById('addition').style.display == 'none') {
d.getElementById('addition').style.display = 'block';
d.getElementById('ab').value = 'Дополнительно <<';
} else {
d.getElementById('addition').style.display = 'none';
d.getElementById('ab').value = 'Дополнительно >>';
  }
}
function HTML() {
if (d.getElementById('result').innerHTML == '')
alert('Введите уравнение');
else {
d.getElementById('html').style.display = 'block';
d.getElementById('html').select();
d.getElementById('html').focus();
  }
}
function Print() {
if (d.getElementById('result').innerHTML == '')
alert('Введите уравнение');
else {
Print = open('', 'Print','');
Print.document.open();
Print.document.write('<html><title>IDV Kvadur v1.0 :: Версия для печати</title><bo'+'dy onLoad=\'window.print()\'>'+d.getElementById('html').value+'</body></html>');
Print.document.close();
  }
}
</script>
     <table class='idv_1'>
     <tr>
<td bgcolor='#0066cc' class='idv_2'><b>IDV Kvadur v1.0 by <a href='http://www.idv-studio.ru' target='_blank' class='idv_3' title='Дизайн студия idv-Studio.ru'>idv-Studio.ru</a></b></td>
   </tr>  
   <tr>
<td bgcolor='#EEECDB' class='idv_4'>
a = <input type='text' id='a' class='idv_5'>
b = <input type='text' id='b' class='idv_5'>
c = <input type='text' id='c' class='idv_5'>
<input type='submit' value='Решить' onClick='Kvadur()' class='idv_9' >
</td>
    </tr>
    <tr>  
<td bgcolor='#EEECDB' class='idv_6'><div id='result' class='idv_7'></div></td>
    </tr>
    <tr>
<td bgcolor='#EEECDB' class='idv_8'>
<div style='padding-bottom: 3px'>
<input type='submit' value='Печать' class='idv_9' onClick='Print()'>
<input type='submit' value='HTML' class='idv_9' onClick='HTML()'>
<input type='submit' id='ab' class='idv_9' value='Дополнительно >>' onClick='Addition()'><br>
</div>
<textarea id='html' style='display:none; width: 189pt'></textarea>
<div id='addition' style='display:none'>
<input type='checkbox' id='i'>Показывать комплексные корни<br>
<input type='checkbox' id='iz'>Показывать точные значения корней<br>
</div>
</td>
   </tr>
     </table>
</body>
</html>
Калькулятор2

Этот калькулятор выглядит наиболее адекватным из всех. Однако невозможно нормально с ним что-либо сделать.

Код:
<style type="text/css">
<!--
body {font-family: helvetica}
p {font-size: 12pt}
.red {color: red}
.blue {color: blue}
-->
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Steve Dulaney -->
<!-- Web Site: http://www.hmhd.com/steve -->
<!-- Begin
var Memory = 0;
var Number1 = "";
var Number2 = "";
var NewNumber = "blank";
var opvalue = "";
function Display(displaynumber) {
document.calculator.answer.value = displaynumber;
}
function MemoryClear() {
Memory = 0;
document.calculator.mem.value = "";
}
function MemoryRecall(answer) {
if(NewNumber != "blank") {
Number2 += answer;
} else {
Number1 = answer;
}
NewNumber = "blank";
Display(answer);
}
function MemorySubtract(answer) {
Memory = Memory - eval(answer);
}
function MemoryAdd(answer) {
Memory = Memory + eval(answer);
document.calculator.mem.value = " M ";
NewNumber = "blank";
}
function ClearCalc() {
Number1 = "";
Number2 = "";
NewNumber = "blank";
Display("");
}
function Backspace(answer) {
answerlength = answer.length;
answer = answer.substring(0, answerlength - 1);
if (Number2 != "") {
Number2 = answer.toString();
Display(Number2);
} else {
Number1 = answer.toString();
Display(Number1);
  }
}
function CECalc() {
Number2 = "";
NewNumber = "yes";
Display("");
}
function CheckNumber(answer) {
if(answer == ".") {
Number = document.calculator.answer.value;
if(Number.indexOf(".") != -1) {
answer = "";
  }
}
if(NewNumber == "yes") {
Number2 += answer;
Display(Number2);
}
else {
if(NewNumber == "blank") {
Number1 = answer;
Number2 = "";
NewNumber = "no";
}
else {
Number1 += answer;
}
Display(Number1);
  }
}
function AddButton(x) {
if(x == 1) EqualButton();
if(Number2 != "") {
Number1 = parseFloat(Number1) + parseFloat(Number2);
}
NewNumber = "yes";
opvalue = '+';
Display(Number1);
}
function SubButton(x) {
if(x == 1) EqualButton();
if(Number2 != "") {
Number1 = parseFloat(Number1) - parseFloat(Number2);
}
NewNumber = "yes";
opvalue = '-';
Display(Number1);
}
function MultButton(x) {
if(x == 1) EqualButton();
if(Number2 != "") {
Number1 = parseFloat(Number1) * parseFloat(Number2);
}
NewNumber = "yes";
opvalue = '*';
Display(Number1);
}
function DivButton(x) {
if(x == 1) EqualButton();
if(Number2 != "") {
Number1 = parseFloat(Number1) / parseFloat(Number2);
}
NewNumber = "yes";
opvalue = '/';
Display(Number1);
}
function SqrtButton() {
Number1 = Math.sqrt(Number1);
NewNumber = "blank";
Display(Number1);
}
function PercentButton() {
if(NewNumber != "blank") {
Number2 *= .01;
NewNumber = "blank";
Display(Number2);
  }
}
function RecipButton() {
Number1 = 1/Number1;
NewNumber = "blank";
Display(Number1);
}
function NegateButton() {
Number1 = parseFloat(-Number1);
NewNumber = "no";
Display(Number1);
}
function EqualButton() {
if(opvalue == '+') AddButton(0);
if(opvalue == '-') SubButton(0);
if(opvalue == '*') MultButton(0);
if(opvalue == '/') DivButton(0);
Number2 = "";
opvalue = "";
}
// End -->
</script>
<!-- HEAD END HERE -->
</head>
<body bgcolor="#EDEDED" text="#000000" link="#000000" topmargin="0" leftmargin="0">
<center>
<!-- BODY START HERE -->
<form name="calculator">
<table bgcolor="#aaaaaa" width=220>
<tr><td>
<table bgcolor="#cccccc" border=1>
<tr><td>
<table border=0 cellpadding=0>
<tr><td bgcolor="#000080"><b style="color:white">Calculator</b></td></tr>
<tr><td>
<table width="100%" border=0>
<tr><td colspan=6><input type="text" name="answer" size=30 maxlength=30 onChange="CheckNumber(this.value)"></td></tr>
<tr><td colspan=6>
<table border=0 cellpadding=0>
<tr><td>
<input type="text" name="mem" size=3 maxlength=3> <input type="button" name="backspace" class="red" value="Backspace" onClick="Backspace(document.calculator.answer.value); return false;"> <input type="button" name="CE" class="red" value=" CE " onClick="CECalc(); return false;"> <input type="reset" name="C" class="red" value=" C " onClick="ClearCalc(); return false;">
</td></tr>
</table>
</td></tr>
<tr><td><input type="button" name="MC" class="red" value=" MC " onClick="MemoryClear(); return false;"></td>
<td><input type="button" name="calc7" class="blue" value=" 7 " onClick="CheckNumber('7'); return false;"></td>
<td><input type="button" name="calc8" class="blue" value=" 8 " onClick="CheckNumber('8'); return false;"></td>
<td><input type="button" name="calc9" class="blue" value=" 9 " onClick="CheckNumber('9'); return false;"></td>
<td><input type="button" name="divide" class="red" value=" / " onClick="DivButton(1); return false;"></td>
<td><input type="button" name="sqrt" class="blue" value="sqrt" onClick="SqrtButton(); return false;"></td></tr>
<tr><td><input type="button" name="MR" class="red" value=" MR " onClick="MemoryRecall(Memory); return false;"></td>
<td><input type="button" name="calc4" class="blue" value=" 4 " onClick="CheckNumber('4'); return false;"></td>
<td><input type="button" name="calc5" class="blue" value=" 5 " onClick="CheckNumber('5'); return false;"></td>
<td><input type="button" name="calc6" class="blue" value=" 6 " onClick="CheckNumber('6'); return false;"></td>
<td><input type="button" name="multiply" class="red" value=" * " onClick="MultButton(1); return false;"></td>
<td><input type="button" name="percent" class="blue" value=" % " onClick="PercentButton(); return false;"></td></tr>
<tr><td><input type="button" name="MS" class="red" value=" MS " onClick="MemorySubtract(document.calculator.answer.value); return false;"></td>
<td><input type="button" name="calc1" class="blue" value=" 1 " onClick="CheckNumber('1'); return false;"></td>
<td><input type="button" name="calc2" class="blue" value=" 2 " onClick="CheckNumber('2'); return false;"></td>
<td><input type="button" name="calc3" class="blue" value=" 3 " onClick="CheckNumber('3'); return false;"></td>
<td><input type="button" name="minus" class="red" value=" - " onClick="SubButton(1); return false;"></td>
<td><input type="button" name="recip" class="blue" value="1/x " onClick="RecipButton(); return false;"></td></tr>
<tr><td><input type="button" name="Mplus" class="red" value=" M+ " onClick="MemoryAdd(document.calculator.answer.value); return false;"></td>
<td><input type="button" name="calc0" class="blue" value=" 0 " onClick="CheckNumber('0'); return false;"></td>
<td><input type="button" name="negate" class="blue" value="+/- " onClick="NegateButton(); return false;"></td>
<td><input type="button" name="dot" class="blue" value=" . " onClick="CheckNumber('.'); return false;"></td>
<td><input type="button" name="plus" class="red" value=" + " onClick="AddButton(1); return false;"></td>
<td><input type="button" name="equal" class="red" value=" = " onClick="EqualButton(); return false;"></td>
</tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
</form>
Калькулятор3

Этот калькулятор имеет много функций, однако он слишком "тяжёлый" и из-за него форум глючит.

Код:
<html>
<head>
<title>WOweb.ru - Scripts - JavaScript - Windows Calculator</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: 12pt}
.red {color: red}
.blue {color: blue}
-->
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Steve Dulaney -->
<!-- Web Site: http://www.hmhd.com/steve -->
<!-- Begin
var Memory = 0;
var Number1 = "";
var Number2 = "";
var NewNumber = "blank";
var opvalue = "";
function Display(displaynumber) {
document.calculator.answer.value = displaynumber;
}
function MemoryClear() {
Memory = 0;
document.calculator.mem.value = "";
}
function MemoryRecall(answer) {
if(NewNumber != "blank") {
Number2 += answer;
} else {
Number1 = answer;
}
NewNumber = "blank";
Display(answer);
}
function MemorySubtract(answer) {
Memory = Memory - eval(answer);
}
function MemoryAdd(answer) {
Memory = Memory + eval(answer);
document.calculator.mem.value = " M ";
NewNumber = "blank";
}
function ClearCalc() {
Number1 = "";
Number2 = "";
NewNumber = "blank";
Display("");
}
function Backspace(answer) {
answerlength = answer.length;
answer = answer.substring(0, answerlength - 1);
if (Number2 != "") {
Number2 = answer.toString();
Display(Number2);
} else {
Number1 = answer.toString();
Display(Number1);
    }
}
function CECalc() {
Number2 = "";
NewNumber = "yes";
Display("");
}
function CheckNumber(answer) {
if(answer == ".") {
Number = document.calculator.answer.value;
if(Number.indexOf(".") != -1) {
answer = "";
    }
}
if(NewNumber == "yes") {
Number2 += answer;
Display(Number2);
}
else {
if(NewNumber == "blank") {
Number1 = answer;
Number2 = "";
NewNumber = "no";
}
else {
Number1 += answer;
}
Display(Number1);
    }
}
function AddButton(x) {
if(x == 1) EqualButton();
if(Number2 != "") {
Number1 = parseFloat(Number1) + parseFloat(Number2);
}
NewNumber = "yes";
opvalue = '+';
Display(Number1);
}
function SubButton(x) {
if(x == 1) EqualButton();
if(Number2 != "") {
Number1 = parseFloat(Number1) - parseFloat(Number2);
}
NewNumber = "yes";
opvalue = '-';
Display(Number1);
}
function MultButton(x) {
if(x == 1) EqualButton();
if(Number2 != "") {
Number1 = parseFloat(Number1) * parseFloat(Number2);
}
NewNumber = "yes";
opvalue = '*';
Display(Number1);
}
function DivButton(x) {
if(x == 1) EqualButton();
if(Number2 != "") {
Number1 = parseFloat(Number1) / parseFloat(Number2);
}
NewNumber = "yes";
opvalue = '/';
Display(Number1);
}
function SqrtButton() {
Number1 = Math.sqrt(Number1);
NewNumber = "blank";
Display(Number1);
}
function PercentButton() {
if(NewNumber != "blank") {
Number2 *= .01;
NewNumber = "blank";
Display(Number2);
    }
}
function RecipButton() {
Number1 = 1/Number1;
NewNumber = "blank";
Display(Number1);
}
function NegateButton() {
Number1 = parseFloat(-Number1);
NewNumber = "no";
Display(Number1);
}
function EqualButton() {
if(opvalue == '+') AddButton(0);
if(opvalue == '-') SubButton(0);
if(opvalue == '*') MultButton(0);
if(opvalue == '/') DivButton(0);
Number2 = "";
opvalue = "";
}
// End -->
</script>
<!-- HEAD END HERE -->
</head>
<body bgcolor="#EDEDED" text="#000000" link="#000000" topmargin="0" leftmargin="0">
<center>
<!-- BODY START HERE -->
<form name="calculator">
<table bgcolor="#aaaaaa" width=220>
<tr><td>
<table bgcolor="#cccccc" border=1>
<tr><td>
<table border=0 cellpadding=0>
<tr><td bgcolor="#000080"><b style="color:white">Calculator</b></td></tr>
<tr><td>
<table width="100%" border=0>
<tr><td colspan=6><input type="text" name="answer" size=30 maxlength=30 onChange="CheckNumber(this.value)"></td></tr>
<tr><td colspan=6>
<table border=0 cellpadding=0>
<tr><td>
<input type="text" name="mem" size=3 maxlength=3> <input type="button" name="backspace" class="red" value="Backspace" onClick="Backspace(document.calculator.answer.value); return false;"> <input type="button" name="CE" class="red" value=" CE " onClick="CECalc(); return false;"> <input type="reset" name="C" class="red" value=" C " onClick="ClearCalc(); return false;">
</td></tr>
</table>
</td></tr>
<tr><td><input type="button" name="MC" class="red" value=" MC " onClick="MemoryClear(); return false;"></td>
<td><input type="button" name="calc7" class="blue" value=" 7 " onClick="CheckNumber('7'); return false;"></td>
<td><input type="button" name="calc8" class="blue" value=" 8 " onClick="CheckNumber('8'); return false;"></td>
<td><input type="button" name="calc9" class="blue" value=" 9 " onClick="CheckNumber('9'); return false;"></td>
<td><input type="button" name="divide" class="red" value=" / " onClick="DivButton(1); return false;"></td>
<td><input type="button" name="sqrt" class="blue" value="sqrt" onClick="SqrtButton(); return false;"></td></tr>
<tr><td><input type="button" name="MR" class="red" value=" MR " onClick="MemoryRecall(Memory); return false;"></td>
<td><input type="button" name="calc4" class="blue" value=" 4 " onClick="CheckNumber('4'); return false;"></td>
<td><input type="button" name="calc5" class="blue" value=" 5 " onClick="CheckNumber('5'); return false;"></td>
<td><input type="button" name="calc6" class="blue" value=" 6 " onClick="CheckNumber('6'); return false;"></td>
<td><input type="button" name="multiply" class="red" value=" * " onClick="MultButton(1); return false;"></td>
<td><input type="button" name="percent" class="blue" value=" % " onClick="PercentButton(); return false;"></td></tr>
<tr><td><input type="button" name="MS" class="red" value=" MS " onClick="MemorySubtract(document.calculator.answer.value); return false;"></td>
<td><input type="button" name="calc1" class="blue" value=" 1 " onClick="CheckNumber('1'); return false;"></td>
<td><input type="button" name="calc2" class="blue" value=" 2 " onClick="CheckNumber('2'); return false;"></td>
<td><input type="button" name="calc3" class="blue" value=" 3 " onClick="CheckNumber('3'); return false;"></td>
<td><input type="button" name="minus" class="red" value=" - " onClick="SubButton(1); return false;"></td>
<td><input type="button" name="recip" class="blue" value="1/x " onClick="RecipButton(); return false;"></td></tr>
<tr><td><input type="button" name="Mplus" class="red" value=" M+ " onClick="MemoryAdd(document.calculator.answer.value); return false;"></td>
<td><input type="button" name="calc0" class="blue" value=" 0 " onClick="CheckNumber('0'); return false;"></td>
<td><input type="button" name="negate" class="blue" value="+/- " onClick="NegateButton(); return false;"></td>
<td><input type="button" name="dot" class="blue" value=" . " onClick="CheckNumber('.'); return false;"></td>
<td><input type="button" name="plus" class="red" value=" + " onClick="AddButton(1); return false;"></td>
<td><input type="button" name="equal" class="red" value=" = " onClick="EqualButton(); return false;"></td>
</tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
</form>
<!-- BODY END HERE -->
</body>
</html>

Помогите пожалуйста подобрать адекватный калькулятор(

Отредактировано Rui7Gamma (12.04.2012 22:18:37)

0

2

Rui7Gamma написал(а):

Помогите пожалуйста подобрать адекватный калькулятор(

Адекватный - это какой? Пока совершенно не понятно (кроме последнего варианта), что вас не устраивает. Вам натуральные логарифмы вычислять или сумму очков подсчитывать? Вам нужен супер умный или простой? Какие задачи собираетесь решать?

0