Create Kalkulator For Blogger (Membuat kalkulator sederhana)

By:
Kalau blog kita digunakan untuk blog belanja online, mungkin sedikit perlu dikasih kemudahan pada user untuk mengkalkusi (menjumlah) harga product sehingga  pembeli dapat menjangkau atau tidak barang yang akan dibeli,  misal seperti kalkulator widget, bagaimana membuatnya untuk para web master bloggers atau sobat sobat bloger ???  sangat mudah sekali kita cukup gunakan kopi paste kode saja !.


yang ingin menggunkan silahkan copas code dibawah ini lantas taru di widget HTML atau di Page (Halaman) HTML.


<center>
<form action="" name="Keypad">
<table>
<b>
<table border="2" width="50" cellpadding="1" cellspacing="5" height="60">
<tr>
<td colspan="3" align="middle">
<input width="100%" value="0" name="ReadOut" size="24" type="Text"/>
</td>
<td
>
<td>
<input value=" C " name="btnClear" onclick="Clear()" type="Button"/>
</td>
<td><input value=" CE " name="btnClearEntry" onclick="ClearEntry()" type="Button"/>
</td>
</td
></tr>
<tr>
<td>
<input value=" 7 " name="btnSeven" onclick="NumPressed(7)" type="Button"/>
</td>
<td>
<input value=" 8 " name="btnEight" onclick="NumPressed(8)" type="Button"/>
</td>
<td>
<input value=" 9 " name="btnNine" onclick="NumPressed(9)" type="Button"/>
</td>
<td>
</td>
<td>
<input value=" +/- " name="btnNeg" onclick="Neg()" type="Button"/>
</td>
<td>
<input value=" % " name="btnPercent" onclick="Percent()" type="Button"/>
</td>
</tr>
<tr>
<td>
<input value=" 4 " name="btnFour" onclick="NumPressed(4)" type="Button"/>
</td>
<td>
<input value=" 5 " name="btnFive" onclick="NumPressed(5)" type="Button"/>
</td>
<td>
<input value=" 6 " name="btnSix" onclick="NumPressed(6)" type="Button"/>
</td>
<td>
</td>
<td align="middle"><input value=" + " name="btnPlus" onclick="Operation('+')" type="Button"/>
</td>
<td align="middle"><input value=" - " name="btnMinus" onclick="Operation('-')" type="Button"/>
</td>
</tr>
<tr>
<td>
<input value=" 1 " name="btnOne" onclick="NumPressed(1)" type="Button"/>
</td>
<td>
<input value=" 2 " name="btnTwo" onclick="NumPressed(2)" type="Button"/>
</td>
<td>
<input value=" 3 " name="btnThree" onclick="NumPressed(3)" type="Button"/>
</td>
<td>
</td>
<td align="middle"><input value=" * " name="btnMultiply" onclick="Operation('*')" type="Button"/>
</td>
<td align="middle"><input value=" / " name="btnDivide" onclick="Operation('/')" type="Button"/>
</td>
</tr>
<tr>
<td>
<input value=" 0 " name="btnZero" onclick="NumPressed(0)" type="Button"/>
</td>
<td>
<input value=" . " name="btnDecimal" onclick="Decimal()" type="Button"/>
</td>
<td colspan="3">
</td>
<td>
<input value=" = " name="btnEquals" onclick="Operation('=')" type="Button"/>
</td>
</tr>
</table>
</b></table>

</form>
</center>
<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 *= 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 Clear () {
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>


SAMPLE/DEMO




























[edit]

1 comment

22 Juli 2016 15.37

bisa diganti2x nga tombolnya?


Pasang INTERNET FASNET PLUS TV KABEL FIRSTMEDIA
Pasang FIRSTMEDIA internet speed hingga 100mbps + CHannel TV HD hingga 50HD hub 087777313417 only SMS