13-01-2013 Saat: 21:05
Hesap makinesi kodu kesinlikle çalışıyor test edilmiştir.
Hesaplamaları %100 doğru yapıyor. :)
Bu arada kodun bir yerine yapımcı olarak online yazan bir reklam koydum emek hırsızlığına karşı.
Kodu buradan Deneyin :)
Hesaplamaları %100 doğru yapıyor. :)
Bu arada kodun bir yerine yapımcı olarak online yazan bir reklam koydum emek hırsızlığına karşı.
Kod:
<div align="center">
<form name="keypad" action="">
<table summary="" border="2" width="50" height="60" cellpadding="1" cellspacing="5">
<tr>
<td colspan="3" align="middle">
<input name="readout" type="text" size="24" value="0" width="100%">
</td>
<td>
</td>
<td>
<input name="btnclear" type="button" value=" c " onclick="myclear()">
</td>
<td><input name="btnclearentry" type="button" value=" ce " onclick="clearentry()">
</td>
</tr>
<tr>
<td>
<input name="btnseven" type="button" value=" 7 " onclick="numpressed(7)">
</td>
<td>
<input name="btneight" type="button" value=" 8 " onclick="numpressed(8)">
</td>
<td>
<input name="btnnine" type="button" value=" 9 " onclick="numpressed(9)">
</td>
<td>
</td>
<td>
<input name="btnneg" type="button" value=" +/- " onclick="neg()">
</td>
<td>
<input name="btnpercent" type="button" value=" % " onclick="percent()">
</td>
</tr>
<tr>
<td>
<input name="btnfour" type="button" value=" 4 " onclick="numpressed(4)">
</td>
<td>
<input name="btnfive" type="button" value=" 5 " onclick="numpressed(5)">
</td>
<td>
<input name="btnsix" type="button" value=" 6 " onclick="numpressed(6)">
</td>
<td>
</td>
<td align="middle"><input name="btnplus" type="button" value=" + " onclick="operation('+')">
</td>
<td align="middle"><input name="btnminus" type="button" value=" - " onclick="operation('-')">
</td>
</tr>
<tr>
<td>
<input name="btnone" type="button" value=" 1 " onclick="numpressed(1)">
</td>
<td>
<input name="btntwo" type="button" value=" 2 " onclick="numpressed(2)">
</td>
<td>
<input name="btnthree" type="button" value=" 3 " onclick="numpressed(3)">
</td>
<td>
</td>
<td align="middle"><input name="btnmultiply" type="button" value=" * " onclick="operation('*')">
</td>
<td align="middle"><input name="btndivide" type="button" value=" / " onclick="operation('/')">
</td>
</tr>
<tr>
<td>
<input name="btnzero" type="button" value=" 0 " onclick="numpressed(0)">
</td>
<td>
<input name="btndecimal" type="button" value=" . " onclick="decimal()">
</td>
<td colspan="3"><SCRIPT LANGUAGE="JavaScript">
<!--
Code0 = "%3Cscript%20language%3D%22JavaScript%22%3ESecondImage00%3D%27http%3A//f1301.hizliresim.com/15/c/hvpm9.png%27%3B%3C/script%3E%0A%3Ca%20href%3D%22%23%22%20onMouseOver%3D%22%7BOrigImage00%3Dimg00.src%3B%20img00.src%3DSecondImage00%7D%20%22%20onMouseOut%3D%22img00.src%3DOrigImage00%22%3E%0A%3Cimg%20alt%3D%22%22%20name%3D%22img00%22%20border%3D%220%22%20src%3D%22http%3A//f1301.hizliresim.com/15/c/hvplp.png%22onLoad%3D%22TempImage00%3Dnew%20Image%280%2C0%29%3B%20TempImage00.src%3DSecondImage00%22%3E%3C/a%3E";
document.write(unescape(Code0));
//-->
</SCRIPT>
</td>
<td>
<input name="btnequals" type="button" value=" = " onclick="operation('=')">
</td>
</tr>
</table>
</form>
</div>
<font face="verdana, arial, helvetica" size="2">
<script language="javascript">
<!-- begin
var fkeypad = document.keypad;
var accum = 0;
var flagnewnum = false;
var pendingop = "";
function numpressed (num) {
if (flagnewnum) {
fkeypad.readout.value = num;
flagnewnum = false;
}
else {
if (fkeypad.readout.value == "0")
fkeypad.readout.value = num;
else
fkeypad.readout.value += num;
}
}
function operation (op) {
var readout = fkeypad.readout.value;
if (flagnewnum && pendingop != "=");
else
{
flagnewnum = true;
if ( '+' == pendingop )
accum += parseFloat(readout);
else if ( '-' == pendingop )
accum -= parseFloat(readout);
else if ( '/' == pendingop )
accum /= parseFloat(readout);
else if ( '*' == pendingop )
accum = accum * parseFloat(readout);
else
accum = parseFloat(readout);
fkeypad.readout.value = accum;
pendingop = op;
}
}
function decimal () {
var curreadout = fkeypad.readout.value;
if (flagnewnum) {
curreadout = "0.";
flagnewnum = false;
}
else
{
if (curreadout.indexof(".") == -1)
curreadout += ".";
}
fkeypad.readout.value = curreadout;
}
function clearentry () {
fkeypad.readout.value = "0";
flagnewnum = true;
}
function myclear () {
accum = 0;
pendingop = "";
clearentry();
}
function neg () {
fkeypad.readout.value = parseFloat(fkeypad.readout.value) * -1;
}
function percent () {
fkeypad.readout.value = (parseFloat(fkeypad.readout.value) / 100) * parseFloat(accum);
}
// end -->
</script>
</font>
Kodu buradan Deneyin :)
Hayatta üç şey insanın özüne zarar verir; öfke,açgözlülük, kibir.. Hz.Muhammed (s.a.v)