Pages

Senin, 29 Desember 2014

Membuat kalkulator sederhana dengan HTML

Kalkulator di bawah ini  di buat dengan javascript dan di jalankan di browser.
di browser akan tampil seperti ini :




<HTML>
    <HEAD><TITLE>Kalkulator</TITLE></HEAD>
    <FORM NAME="Input">
    <h1>Kalkulator</h1>
        <TABLE BORDER="4" >
        <tr><TD colspan="5"><INPUT TYPE="text" NAME="Input" Size="37"><br></TD></tr>
        <tr>
    <TD><INPUT  TYPE="button" NAME="clear"  VALUE="MS" OnCLick="Calc.Input.value = ''"></td>
    <td><INPUT TYPE="button" NAME="MR" VALUE="MR" OnClick="Calc.Input.value = ''"></td>
    <td><INPUT TYPE="button" NAME="MS" VALUE="MS" OnClick="Calc.Input.value = ''"></td>
    <td><INPUT TYPE="button" NAME="minus"  VALUE="-M" OnClick="Calc.Input.value += '-'"></td>
    <td><INPUT TYPE="button" NAME="plus" VALUE="+M" OnClick="Calc.Input.value = '+'"></td></tr>
    <tr>
    <td><INPUT TYPE="button" NAME="seven" VALUE="   7   " OnClick="Calc.Input.value += '7'"></td>
    <td><INPUT TYPE="button" NAME="eight" VALUE="   8   " OnCLick="Calc.Input.value += '8'"></td>
    <td><INPUT TYPE="button" NAME="nine"  VALUE="   9   " OnClick="Calc.Input.value += '9'"></td>
    <td><INPUT TYPE="button" NAME="div"   VALUE="   /   " OnClick="Calc.Input.value += ' / '"></td>
    <td><INPUT TYPE="button" NAME="div"   VALUE="  %  " OnClick="Calc.Input.value += ' % '"></td></tr>
    <tr>
    <td><INPUT TYPE="button" NAME="four"  VALUE="   4   " OnClick="Calc.Input.value += '4'"></td>
    <td><INPUT TYPE="button" NAME="five"  VALUE="   5   " OnCLick="Calc.Input.value += '5'"></td>
    <td><INPUT TYPE="button" NAME="six"   VALUE="   6   " OnClick="Calc.Input.value += '6'"></td>
    <td><INPUT TYPE="button" NAME="six"   VALUE="   *   " OnClick="Calc.Input.value += '*'"></td>
    <td><INPUT TYPE="button" NAME="six"   VALUE="1/X" OnClick="Calc.Input.value += '1/*'"></td></tr>
    <tr>
    <td><INPUT TYPE="button" NAME="one"   VALUE="   1   " OnClick="Calc.Input.value += '1'"></td>
    <td><INPUT TYPE="button" NAME="two"   VALUE="   2   " OnCLick="Calc.Input.value += '2'"></td>
    <td><INPUT TYPE="button" NAME="three" VALUE="   3   " OnClick="Calc.Input.value += '3'"></td>
    <td><INPUT TYPE="button" NAME="minus"  VALUE="   -   " OnClick="Calc.Input.value += ' - '"></td>
    <td rowspan="2"><INPUT TYPE="button" NAME="DoIt"  VALUE="    =  " OnClick="Calc.Input.value = eval(Calc.Input.value)"></td></tr>
    <tr>
    <td colspan="2"><INPUT TYPE="button" NAME="minus" VALUE="  0  " OnClick="Calc.Input.value += ' - '"></td>
    <td><INPUT TYPE="button" NAME="times" VALUE="    .   " width="30" height="30"OnClick="Calc.Input.value += ' . '"></td>
    <td><INPUT TYPE="button" NAME="plus" VALUE="   +  " OnClick="Calc.Input.value += '+'"></td>
    </tr>
    </TABLE></html>


Untuk Di tampilkan di lokal komputer copy scriptnya ke dalam notepad kemudian save as misalnya kalkulator.html dengan format all file kmudian pilih save untuk menyimpan.


Buka file kalkulator dengan browser mozila, Internet Exporer, google chrome dll.

Selamat mencoba. :)

1 komentar:

  1. Lucky Eagle Casino Resort - Mapyro
    Find 순천 출장샵 the perfect location for your next trip. Get directions, reviews 광양 출장샵 and information for Lucky Eagle Casino Resort 대구광역 출장마사지 in Eagle Pass, What are the check-in 포천 출장안마 and check-out times at Lucky Eagle 김천 출장샵 Casino Resort?Can I play at Lucky Eagle Casino Resort in Eagle Pass?

    BalasHapus