ahtml>
<title>Membuat program kalkulator sederhana menggunakan textbox </title>
<SCRIPT LANGUAGE="JavaScript">
function tambah()
{
m=eval(form.m.value)
n=eval(form.n.value)
q=m+n
form.hasil.value =q
}
function kurang()
{
m=eval(form.m.value)
n=eval(form.n.value)
q=m-n
form.hasil.value=q
}
function kali()
{
m=eval(form.m.value)
n=eval(form.n.value)
q=m*n
form.hasil.value=q
}
function bagi()
{
m=eval(form.m.value)
n=eval(form.n.value)
q=m/n
form.hasil.value =q
}
function kosong()
{
form.a.focus()
form.a.value=""
form.b.value=""
form.hasil.value=""
}
</SCRIPT>
<body bgcolor="#999999">
<table width="744">
<tr>
<td bgcolor="#666666"><font size="+4">
<marquee>
Kalkulator JS
</marquee>
</font></td>
</tr>
</table>
<FORM name="form">
<pre>Masukkan Angka 1 : <input type="text" name="m">
Masukkan Angka 2 : </font><input type="text" name="n">
<font color="#000000">Hasil :</font> <font color="#FFFF00"><input type "text" name="hasil" disabled="true"></font>
</pre>
<p>
<input type="button" value=" + " onClick="tambah()">
<input type="button" value=" - " onClick="kurang()">
<input type="button" value=" x " onClick="kali()">
<input type="button" value=" / " onClick="bagi()">
</p>
<p><em><font face="Verdana, Arial, Helvetica, sans-serif">i dewa gde agung wira adnyana (10101056)</font></em></p>
</FORM>
<p> </p>
</body>
</html>
<title>Membuat program kalkulator sederhana menggunakan textbox </title>
<SCRIPT LANGUAGE="JavaScript">
function tambah()
{
m=eval(form.m.value)
n=eval(form.n.value)
q=m+n
form.hasil.value =q
}
function kurang()
{
m=eval(form.m.value)
n=eval(form.n.value)
q=m-n
form.hasil.value=q
}
function kali()
{
m=eval(form.m.value)
n=eval(form.n.value)
q=m*n
form.hasil.value=q
}
function bagi()
{
m=eval(form.m.value)
n=eval(form.n.value)
q=m/n
form.hasil.value =q
}
function kosong()
{
form.a.focus()
form.a.value=""
form.b.value=""
form.hasil.value=""
}
</SCRIPT>
<body bgcolor="#999999">
<table width="744">
<tr>
<td bgcolor="#666666"><font size="+4">
<marquee>
Kalkulator JS
</marquee>
</font></td>
</tr>
</table>
<FORM name="form">
<pre>Masukkan Angka 1 : <input type="text" name="m">
Masukkan Angka 2 : </font><input type="text" name="n">
<font color="#000000">Hasil :</font> <font color="#FFFF00"><input type "text" name="hasil" disabled="true"></font>
</pre>
<p>
<input type="button" value=" + " onClick="tambah()">
<input type="button" value=" - " onClick="kurang()">
<input type="button" value=" x " onClick="kali()">
<input type="button" value=" / " onClick="bagi()">
</p>
<p><em><font face="Verdana, Arial, Helvetica, sans-serif">i dewa gde agung wira adnyana (10101056)</font></em></p>
</FORM>
<p> </p>
</body>
</html>
0 komentar:
Posting Komentar