MODUL 5
TUGAS PRAKTIKUM
<!DOCTYPE html>
<html lang="en">
<head>
<title>Tugas Praktikum</title>
<script type="text/javascript" src="tuprak.js"></script>
</head>
<body>
<h2>Form Pemesanan Berbasis JavaScript</h2>
<form name="mnda" action="#">
<table border="1px">
<tr>
<th>No</th>
<th>Makanan/Minuman</th>
<th>Harga</th>
<th>Pesan</th>
</tr>
<tr>
<td>1.</td>
<td>Bakso</td>
<td>@ <input type="text" name="menu1" value="6000" disabled="true" /></td>
<td><input type="text" name="pesan1" value="0" onchange="total(),diskon(),bayar()" onclick="nol1()" /></td>
</tr>
<tr>
<td>2.</td>
<td>Mie Goreng</td>
<td>@ <input type="text" name="menu2" value="3500" disabled="true" /></td>
<td><input type="text" name="pesan2" value="0" onchange="total(),diskon(),bayar()" onclick="nol2()" /></td>
</tr>
<tr>
<td>3.</td>
<td>Mie Ayam</td>
<td>@ <input type="text" name="menu3" value="5000" disabled="true" /></td>
<td><input type="text" name="pesan3" value="0" onchange="total(),diskon(),bayar()" onclick="nol3()" /></td>
</tr>
<tr>
<td>4.</td>
<td>Nasi Goreng</td>
<td>@ <input type="text" name="menu4" value="6000" disabled="true" /></td>
<td><input type="text" name="pesan4" value="0" onchange="total(),diskon(),bayar()" onclick="nol4()" /></td>
</tr>
<tr>
<td>5.</td>
<td>Telur Asin</td>
<td>@ <input type="text" name="menu5" value="2000" disabled="true" /></td>
<td><input type="text" name="pesan5" value="0" onchange="total(),diskon(),bayar()" onclick="nol5()" /></td>
</tr>
<tr>
<td>6.</td>
<td>Air Putih</td>
<td>@ <input type="text" name="menu6" value="500" disabled="true" /></td>
<td><input type="text" name="pesan6" value="0" onchange="total(),diskon(),bayar()" onclick="nol6()" /></td>
</tr>
<tr>
<td>7.</td>
<td>Es Teh Anget</td>
<td>@ <input type="text" name="menu7" value="1500" disabled="true" /></td>
<td><input type="text" name="pesan7" value="0" onchange="total(),diskon(),bayar()" onclick="nol7()" /></td>
</tr>
<tr>
<td>8.</td>
<td>Es Jeruk Anget</td>
<td>@ <input type="text" name="menu8" value="2000" disabled="true" /></td>
<td><input type="text" name="pesan8" value="0" onchange="total(),diskon(),bayar()" onclick="nol8()" /></td>
</tr>
<tr>
<td>9.</td>
<td>Teh Panas</td>
<td>@ <input type="text" name="menu9" value="1500" disabled="true" /></td>
<td><input type="text" name="pesan9" value="0" onchange="total(),diskon(),bayar()" onclick="nol9()" /></td>
</tr>
<tr>
<td>10.</td>
<td>SoGem</td>
<td>@ <input type="text" name="menu10" value="5000" disabled="true" /></td>
<td><input type="text" name="pesan10" value="0" onchange="total(),diskon(),bayar()" onclick="nol10()" /></td>
</tr>
<tr>
<td colspan="3" align="right">Total Bayar</td>
<td><input type="text" name="total_bayar" disabled="true" /></td>
</tr>
<tr>
<td colspan="3" align="right">Diskon</td>
<td><input type="text" name="pot_har" disabled="true" /></td>
</tr>
<tr>
<td colspan="3" align="right">Jumlah Bayar</td>
<td><input type="text" name="Jum_bayar" disabled="true" /></td>
</tr>
</table>
Gak jadi :
<input type="button" value=" Bantal " onclick="hapus()" />
<p> ©
<a href="http://www.facebook.com/anggaconello">angga achmad c</a>
</form>
</body>
</html>
Modul 5
STUDI KASUS
<!DOCTYPE html>
<html lang="en">
<head>
<title>kalkulator sederhana</title>
</head>
<body>
<p>Kalkulator Sederhana dengan JavaScript
<script language="JavaScript" type="text/javascript">
<!--
function tambah() {
var a = eval (document.form1.a.value)
var b = eval (document.form1.b.value)
c = a+b
document.form1.hasil.value = +c
}
function kurang() {
var a = eval (document.form1.a.value)
var b = eval (document.form1.b.value)
var c = a-b
document.form1.hasil.value = +c
}
function kali() {
var a = eval (document.form1.a.value)
var b = eval (document.form1.b.value)
var c = a*b
document.form1.hasil.value = c
}
function bagi() {
var a = eval (document.form1.a.value)
var b = eval (document.form1.b.value)
var c = a/b
document.form1.hasil.value = c
}
function hapus () {
document.form1.reset();
}
-->
</script>
<form name=form1 action="#">
<p>Bilangan 1 :
<input type="text" name="a" />
<p>Bilangan 2 :
<input type="text" name="b" />
<p>
<input type="button" value=" + " onclick="tambah()" />
<input type="button" value=" - " onclick="kurang()" />
<input type="button" value=" * " onclick="kali()" />
<input type="button" value=" / " onclick="bagi()" />
<p>Hasil :
<input type="text" name="hasil" disabled="true" />
<p>Bersihkan :
<input type="button" value=" Clear " onclick="hapus()" />
</form>
<p> ©
<a href="http://www.facebook.com/angga conello">angga achmad c</a>
</body>
</html>