Иногда глючит
Вставляем туда где хотим его видеть
Код:
<!-- 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: evsikoff_andrey --> <!-- web site: Зарегься чтобы увидеть ссылкиhttp://gsmevsikov.mybb.ru/ --> <!-- 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 -->