Tuesday, May 23, 2017

Membuat Kalkulator HTML



Ini Scriptnya :


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Kalkulator</title>

</head>
<body>
<br />
<center><b><h3><font>Calculator</font></h3></b></center>
<pre>
<form method="post" action="" name="cal">
<table border="1" align="center">
<tr>
<td width="240" height="110">
<br />
<center><input type="text" name="ang1" size="27"/> <br /><br />

<input type="reset" name="reset" value="C" style="width:165px;height:40px;"/> <input type="button" name="angka7" value="/" style="width:50px;height:40px;" onclick="cal.ang1.value += '/'"/> <br /><br />

<input type="button" name="angka7" value="7" style="width:50px;height:40px;" onclick="cal.ang1.value += '7'"/>
<input type="button" name="angka8" value="8"  style="width:50px;height:40px;" onclick="cal.ang1.value += '8'"/>
<input type="button" name="angka9" value="9"  style="width:50px;height:40px;" onclick="cal.ang1.value += '9'"/>

<input type="button" name="bagi" value="*"  style="width:50px;height:40px;" onclick="cal.ang1.value += '*'"/> <br /><br />

<input type="button" name="angka4" value="4" style="width:50px;height:40px;" onclick="cal.ang1.value += '4'"/>
<input type="button" name="angka5" value="5"  style="width:50px;height:40px;" onclick="cal.ang1.value += '5'"/>
<input type="button" name="angka6" value="6"  style="width:50px;height:40px;" onclick="cal.ang1.value += '6'"/>

<input type="button" name="kali" value="-"  style="width:50px;height:40px;" onclick="cal.ang1.value += '-'"/> <br /><br />

<input type="button" name="angka1" value="1" style="width:50px;height:40px;" onclick="cal.ang1.value += '1'"/>
<input type="button" name="angka2" value="2"  style="width:50px;height:40px;" onclick="cal.ang1.value += '2'"/>
<input type="button" name="angka3" value="3"  style="width:50px;height:40px;" onclick="cal.ang1.value += '3'"/>

<input type="button" name="kurang" value="+"  style="width:50px;height:40px;" onclick="cal.ang1.value += '+'"/> <br /><br />

<input type="button" name="angka0" value="0" style="width:165px;height:40px;" onclick="cal.ang1.value += '0'"/>

<input type="button" name="DoIt" value="=" style="width:50px;height:40px;" onclick="cal.ang1.value = eval(cal.ang1.value)"></center> <br /><br />
</td>
</tr>
</table>
</pre>
</form>
</body>
</html>

0 comments:

Post a Comment