Calculator fuck/HTML Code

:
<nowiki><html>
<body>
<h1>Two variable based language</h1>
x: <input id="Var1" type="text" value="0" />
<br />
y: <input id="Var2" type="text" value="0" />
<br />
code
<br />
<textarea id="Coding" cols="70" rows="10"></textarea>
<br />
output
<br />
<textarea id="Output" readonly="readonly" cols="70" rows="10"></textarea>
<br />
<input type="button" onclick="__clear()" value="X" />
<input type="button" value="run" onclick="__run()" />
<hr />
<pre style="width:100px" onclick="++Var1.value;Coding.value += '*+'">x += 1</pre>
<pre style="width:100px" onclick="++Var2.value;Coding.value += '+*'">y += 1</pre>
<pre style="width:100px" onclick="--Var1.value;Coding.value += '*-'">x -= 1</pre>
<pre style="width:100px" onclick="--Var2.value;Coding.value += '-*'">y -= 1</pre>
<pre style="width:100px" onclick="var s = Var1.value; Var1.value = Var2.value; Var2.value = s; Coding.value += '**'">x &lt;--&gt; y</pre>
<pre style="width:100px" onclick="Var1.value = +Var1.value+ +Var2.value ; Coding.value += '$+'">x += y</pre>
<pre style="width:100px" onclick="Var2.value = +Var1.value+ +Var2.value ; Coding.value += '+$'">y += x</pre>
<pre style="width:100px" onclick="Var1.value = Var1.value-Var2.value; Coding.value += '$-'">x = x - y</pre>
<pre style="width:100px" onclick="Var2.value = Var1.value-Var2.value; Coding.value += '-$'">y = x - y</pre>
<pre style="width:100px" onclick="Var1.value = Var2.value-Var1.value; Coding.value += '@-'">x = y - x</pre>
<pre style="width:100px" onclick="Var2.value = Var2.value-Var1.value; Coding.value += '-@'">y = y - x</pre>
<pre style="width:100px" onclick="Var1.value *= -1; Coding.value += '!*'">x = -x</pre>
<pre style="width:100px" onclick="Var2.value *= -1; Coding.value += '*!'">y = -y</pre>
<pre style="width:100px" onclick="Var1.value *= 2; Coding.value += '*2'">x *= 2</pre>
<pre style="width:100px" onclick="Var2.value *= 2; Coding.value += '2*'">y *= 2</pre>
<pre style="width:100px" onclick="Var1.value = Var1.value * Var2.value ; Coding.value += '*m'">x *= y</pre>
<pre style="width:100px" onclick="Var2.value = Var1.value * Var2.value ; Coding.value += 'm*'">y *= x</pre>
<pre style="width:100px" onclick="Var1.value = Math.floor(Var1.value / 2); Coding.value += '*g'">x /= 2</pre>
<pre style="width:100px" onclick="Var2.value = Math.floor(Var2.value / 2); Coding.value += 'g*'">y /= 2</pre>
<pre style="width:100px" onclick="Var1.value = Math.floor(Var1.value / Var2.value); Coding.value += '*d'">x = x / y</pre>
<pre style="width:100px" onclick="Var2.value = Math.floor(Var1.value / Var2.value); Coding.value += 'd*'">y = x / y</pre>
<pre style="width:100px" onclick="Var1.value = Math.floor(Var2.value / Var1.value); Coding.value += '*f'">x = y / x</pre>
<pre style="width:100px" onclick="Var2.value = Math.floor(Var2.value / Var1.value); Coding.value += 'f*'">y = y / x</pre>
<pre style="width:100px" onclick="Output.value += String.fromCharCode(+Var1.value); Coding.value += '*p'">print x</pre>
<pre style="width:100px" onclick="Output.value += String.fromCharCode(+Var2.value); Coding.value += 'p*'">print y</pre>
<pre style="width:100px" onclick="Var1.value = 0; Coding.value += '*0'">x -> 0</pre>
<pre style="width:100px" onclick="Var2.value = 0; Coding.value += '0*'">y -> 0</pre>
</body>
<script type="text/javascript">
//<![CDATA[
var __clear = function () {
 Var1.value = 0;
 Var2.value = 0;
 Output.value = ;
 Coding.value = ;
}
var __run = function () {
 // initialize
 Var1.value = 0;
 Var2.value = 0;
 Output.value = ;
 for(var i = 0; i < Coding.value.length; i += 2) {
 switch (Coding.value.slice(i,i + 2)){
 case "*+":
 ++Var1.value;
 break;
 case "+*":
 ++Var2.value;
 break;
 case "*-":
 --Var1.value;
 break;
 case "-*":
 --Var2.value;
 break;
 case "**":
 var s = Var1.value;
 Var1.value = Var2.value;
 Var2.value = s;
 break;
 case "$+":
 Var1.value = +Var1.value + +Var2.value;
 break;
 case "+$":
 Var2.value = +Var1.value + +Var2.value;
 break;
 case "$-":
 Var1.value = Var1.value-Var2.value;
 break;
 case "-$":
 Var2.value = Var1.value-Var2.value;
 break;
 case "@-":
 Var1.value = Var2.value-Var1.value;
 break;
 case "-@":
 Var2.value = Var2.value-Var1.value;
 break;
 case "!*":
 Var1.value *= -1;
 break;
 case "*!":
 Var2.value *= -1;
 break;
 case "*2":
 Var1.value *= 2;
 break;
 case "2*":
 Var2.value *= 2;
 break;
 case "*m":
 Var1.value *= Var2.value;
 break;
 case "m*":
 Var2.value *= Var1.value;
 break;
 case "*g":
 Var1.value = Math.floor(Var1.value/2);
 break;
 case "g*":
 Var2.value = Math.floor(Var2.value/2);
 break;
 case "*d":
 Var1.value = Math.floor(Var1.value/Var2.value);
 break;
 case "d*":
 Var2.value = Math.floor(Var1.value/Var2.value);
 case "*f":
 Var1.value = Math.floor(Var2.value/Var1.value);
 break;
 case "f*":
 Var2.value = Math.floor(Var2.value/Var1.value);
 break;
 case "*p":
 Output.value += String.fromCharCode(+Var1.value);
 break;
 case "p*":
 Output.value += String.fromCharCode(+Var2.value);
 break;
 case "*0":
 Var1.value = 0;
 break;
 case "0*":
 Var2.value = 0;
 }
 }
}
//]]>
</script>
</html></nowiki>
Category:Implementations