.Silahkan Masukan Kata Kunci.

.About Me.

Foto saya
- Simple - Care - Jelek - Ramah - Friendly - Gx neko" . ah ketang gmn anda yang mnilai saja lah .
dhilz.kobbo.shared :: Berbagi Aplikasi Full + informasi gratis..!!

CARA JADI JUTAWAN VIA ONLINE

Jumat, 24 Desember 2010

. Membuat Calculator sederhana menggunakan JAVA n sedikit HTML .

halo abang - abang semua.a,.,.dah lama nie gx posting seswatu d blog.,.,rasa.a sepet" gmn gtu.,.,hha,.

abang - abang x ini kobbo mu share bgaimana memadukan sedikit html n pembuatan calculator sederhana menggunakan JAVA...yuk langsung za abang - abang sadaaaaaaaaaap coding.a,.,.n langsung za coba gmn hasil.a...

<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<!–halaman CONTENT dimulai –>
<B>_-_ kobbo created _-_
</BODY>
</HTML>
<BR>
</BR>

<form name="Keypad" action>


<table border="1"  bgcolor="#838393">


<tr>


<td colspan="5" bgcolor="#DFDFDF">


 <input name="ReadOut" type="Text" size="30" value="0">


</td>


</tr>


<tr>


<td bgcolor="#DFDFDF">


<input name="btnSeven" type="Button" value="  7  " onClick="NumPressed(7)">


</td>


<td bgcolor="#DFDFDF">


<input name="btnEight" type="Button" value="  8  " onClick="NumPressed(8)">


</td>


<td bgcolor="#DFDFDF">


<input name="btnNine" type="Button" value="  9  " onClick="NumPressed(9)">


</td>


<td bgcolor="#DFDFDF"><input name="btnNeg" type="Button" value=" +/- " onClick="Neg()"></td>


<td bgcolor="#DFDFDF"><input name="btnPercent" type="Button" value=" % " onClick="Percent()"></td>





</tr>


<tr>


<td bgcolor="#DFDFDF">


<input name="btnFour" type="Button" value="  4  " onClick="NumPressed(4)">


</td>


<td bgcolor="#DFDFDF">


<input name="btnFive" type="Button" value="  5  " onClick="NumPressed(5)">


</td>


<td bgcolor="#DFDFDF">


<input name="btnSix" type="Button" value="  6  " onClick="NumPressed(6)">


</td>


<td bgcolor="#DFDFDF"><input name="btnPlus" type="Button" value="  +  "


 onClick="Operation('+')"></td>


<td bgcolor="#DFDFDF"><input name="btnMultiply" type="Button" value="  *  "


 onClick="Operation('*')"></td>






</tr>


<tr>


<td bgcolor="#DFDFDF">


<input name="btnOne" type="Button" value="  1  " onClick="NumPressed(1)">


</td>


<td bgcolor="#DFDFDF">


<input name="btnTwo" type="Button" value="  2  " onClick="NumPressed(2)">


</td>


<td bgcolor="#DFDFDF">


<input name="btnThree" type="Button" value="  3  " onClick="NumPressed(3)">


</td>


<td bgcolor="#DFDFDF"><input name="btnMinus" type="Button" value="  -  "


 onClick="Operation('-')"></td>


<td bgcolor="#DFDFDF"><input name="btnDivide" type="Button" value="  /  "


 onClick="Operation('/')"></td>





</tr>


<tr>


<td bgcolor="#DFDFDF">


<input name="btnZero" type="Button" value="  0  " onClick="NumPressed(0)">


</td>


<td bgcolor="#DFDFDF">


<input name="btnDecimal" type="Button" value="  .  " onClick="Decimal()">


</td>


<td colspan="3"  bgcolor="#797979">


 <input name="btnClear" type="Button" value="  C  " onClick="Clear()">


 <input name="btnClearEntry" type="Button" value=" CE " onClick="ClearEntry()">


 <input name="btnEquals" type="Button" value="  =  " onClick="Operation('=')"></td>


</tr>


</table>


</form>


 <script LANGUAGE="JavaScript">





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);
133
}
134
</script>
</br>
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<!–halaman CONTENT dimulai –>
<B>_-_ Try At Home _-_
</BODY>
</HTML>

nb :: untuk percobaan pertama bisa d coba menggunakan notepad...

1. buka notepad
2. copas coding.a
3. save dengan nama test.html ( jangan lupa type file.a all file )

SEMOGA BERMANFAAT

:) --> :)- :D --> :D- :$ --> :$ :( --> :(-:p --> :p-;) --> ;)-:k --> :k-:@ --> :@-
:# --> :#-:x --> :x*:o --> :o * :L --> :L = :O --> :O - :r --> :r - :y --> :y :t --> :t - :s --> :s - :~ --> :~ - :v --> :v - :f --> :f - :d --> :d - :c --> :c :z --> :z


n_n

0 komentar:

Posting Komentar

Powered by eSnips.com
Twitter Delicious Facebook Digg Stumbleupon Favorites More