<head>
<title> Calculate machine </title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="Calc.js">
</script>
</head>
<body style="background-image:url(1.jpg)">
<form name="calc" action="" align="center">
<table class="Calculator">
<tr>
<td colspan=5 align="center">
<input id="ciField" name="field" type="Text" size=30 value="0" width="300px">
</td>
</tr>
<tr>
<td> <input name="MC" type="Button" class="Red" value="MC" onclick="" /></td>
<td> <input name="MR" type="Button" class="Red" value="MR" onclick="" /></td>
<td> <input name="MS" type="Button" class="Red" value="MS" onclick="" /></td>
<td> <input name="M+" type="Button" class="Red" value="M+" onclick="" /></td>
<td> <input name="M-" type="Button" class="Red" value="M-" onclick="" /></td>
</tr>
<tr>
<td> <input name="Backspace" type="Button" class="Gray" value="←" onclick="backspace()" /></td>
<td> <input name="CE" type="Button" class="Gray" value="CE" onclick="clrE()" /></td>
<td> <input name="C" type="Button" class="Gray" value="C" onclick="clr()" /></td>
<td> <input name="plusmn" type="Button" class="Blue" value="±" onclick="changeSign()" /></td>
<td> <input name="sqrt" type="Button" class="Blue" value="√" onclick="sqt()" /></td>
</tr>
<tr>
<td> <input name="Seven" type="Button" class="Gray" value="7" onclick='take("7")' /></td>
<td> <input name="Eight" type="Button" class="Gray" value="8" onclick='take("8")' /></td>
<td> <input name="Nine" type="Button" class="Gray" value="9" onclick='take("9")' /></td>
<td> <input name="Divide" type="Button" class="Blue" value="/" onclick='take("/")' /></td>
<td> <input name="Percent" type="Button" class="Blue" value="%" onclick="" /></td>
</tr>
<tr>
<td> <input name="Four" type="Button" class="Gray" value="4" onclick='take("4")' /></td>
<td> <input name="Five" type="Button" class="Gray" value="5" onclick='take("5")' /></td>
<td> <input name="Six" type="Button" class="Gray" value="6" onclick='take("6")' /></td>
<td> <input name="Multiple" type="Button" class="Blue" value="*" onclick='take("*")' /></td>
<td> <input name="OneDivX" type="Button" class="Blue" value="1/x" onclick="oneDivX()" /></td>
</tr>
<tr>
<td> <input onkeypress="1" name="One" class="Gray" type="Button" value="1" onclick='take("1")' /></td>
<td> <input name="Two" type="Button" class="Gray" value="2" onclick='take("2")' /></td>
<td> <input name="Three" type="Button" class="Gray" value="3" onclick='take("3")' /></td>
<td> <input name="Minus" type="Button" class="Blue" value="-" onclick='take("-")' /></td>
<td rowspan="2"> <input id="buttHide" name="Equal" type="Button" class="Gray" value="=" onclick='operation("=")' /></td>
</tr>
<tr>
<td colspan="2"> <input id="buttWide" name="Zero" type="Button" class="Gray" value="0" onclick='take("0")' /></td>
<td> <input name="Dot" type="Button" value="." class="Gray" onclick="dot()" /></td>
<td> <input name="Plus" type="Button" class="Blue" value="+" onclick='operation("+")' /></td>
</tr>
</table>
</form>
</body>
.Calculator {
background-color:#3d4543;
height:350px;
width:250px;
border-radius:10px;
position:relative;
top:250px;
left:43%;}
.Calculator input {
width:40px;
height:30px;
margin: 4px;
border-radius:8px;}
#ciField {
background-color: #bccd95;
text-align:right;
width: 250px;
margin-top: 10px;
margin-left: 5px;
margin-right: 5px;
font: 30px 'Press Start 2P';}
#buttWide {
width: 90px;}
#buttHide {
Height: 75px;}
.Gray {
color:white;
background-color:#6f6f6f;}
.Red{
color:white;
background-color:#ff4561;}
.Blue{
color:white;
background-color:#0000FF;}
var current; //Текущая
var middVar = 0; //Промежуточная
var sign = "";
function take(num)
{
"use strict";
if (document.getElementById("ciField").value === "0")
{
document.getElementById("ciField").value = num;
}
else
{
document.getElementById("ciField").value += num;
}
}
function operation(op)
{
"use strict";
current = document.getElementById("ciField").value;
if(op == "=")
{ //Если = то выполняем операцию
switch(sign)
{
case '+': middVar += current;
document.getElementById("ciField").value = middVar;
break;
}
}
else //иначе переносим из текущей в промежуточную
{
middVar = current;
document.getElementById("ciField").value = '0';
sign = op;
}
}
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |