Laman

Selasa, 01 Maret 2011

Kode Program Tugas Form Menu Makanan

<!DOCTYPE html>
<html lang="en">
<html>
<head>
<title>warung KOIBITO</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
function hitungPesan(){
var myForm = document.form1;
var baksourat = 14000 * eval(myForm.menu1.value);
var baksosuper = 8000 * eval(myForm.menu2.value);
var soto = 10000 * eval(myForm.menu3.value);
var mie = 15000 * eval(myForm.menu4.value);
var degan = 7000 * eval(myForm.menu5.value);
var kopyor = 7000 * eval(myForm.menu6.value);
var hasil = baksourat + baksosuper + soto + mie + degan + kopyor;
if (hasil > 50000){
myForm.Total.value = hasil;
myForm.Diskon.value = 20000;
myForm.Bayar.value = hasil - 10000;
} else {
myForm.Total.value = hasil;
myForm.Diskon.value = 0;
myForm.Bayar.value = hasil - 0;
}

myForm.bayar1.value=baksourat;
myForm.bayar2.value=baksosuper;
myForm.bayar3.value=soto;
myForm.bayar4.value=mie;
myForm.bayar5.value=degan;
myForm.bayar6.value=kopyor;
}

//-->
</script>
<h3>FORM DAFTAR HARGA MENU MAKANAN</h3>
<form name="form1" action="#">
<table border="1" cellspacing= 0 cellpadding=10>
<tr>
<th>No</th>
<th>Makanan/Minuman</th>
<th>Harga</th>
<th>Pesan</th>
<th>Total</th>

</tr>
<tr>
<td width="15">1</td>
<td width="400">Bakso Urat Super Besar istimewa(1 porsi)</td>
<td width="150">@<input type="text" name="baksourat" value="14000" size="15" disabled="true"/></td>
<td width="150"><input type="text" name="menu1" value="0" onChange="hitungPesan()"/></td>
<td width="150" align="right"><input type="text" name="bayar1" disabled="true"/></td>
</tr>
<td>2</td>
<td>Bakso Urat Super Besar(1 porsi)</td>
<td>@<input type="text" name="baksosuper" value="8000" size="15" disabled="true"/></td>
<td><input type="text" name="menu2" value="0" onChange="hitungPesan()"/></td>
<td><input type="text" name="bayar2" disabled="true"/></td>
<tr>
<td>3</td>
<td>Soto Spesial</td>
<td>@<input type="text" name="soto" value="10000" size="15" disabled="true"/></td>
<td><input type="text" name="menu3" value="0" onChange="hitungPesan()"/></td>
<td><input type="text" name="bayar3" disabled="true"/></td>
</tr>
<tr>
<td>4</td>
<td>Mie Ayam Super</td>
<td>@<input type="text" name="mie" value="15000" size="15" disabled="true"/></td>
<td><input type="text" name="menu4" value="0" onChange="hitungPesan()"/></td>
<td><input type="text" name="bayar4" disabled="true"/></td>
</tr>
<tr>
<td>5</td>
<td>Es Degan</td>
<td>@<input type="text" name="degan" value="7000" size="15" disabled="true"/></td>
<td><input type="text" name="menu5" value="0" onChange="hitungPesan()"/></td>
<td><input type="text" name="bayar5" disabled="true"/></td>
</tr>
<tr>
<td>6</td>
<td>Es Kopyor</td>
<td>@<input type="text" name="kopyor" value="7000" size="15" disabled="true"/></td>
<td><input type="text" name="menu6" value="0" onChange="hitungPesan()"/></td>
<td><input type="text" name="bayar6" disabled="true"/></td>
</tr>
<tr>
<td colspan="4" align="right">Jumlah Total</td>
<td><input type="text" name="Total" disabled="true" /></td>
</tr>
<tr>
<td colspan="4" align="right">Diskon</td>
<td><input type="text" name="Diskon" disabled="true" /></td>
</tr>
<tr>
<td colspan="4" align="right">Jumlah Dibayar</td>
<td><input type="text" name="Bayar" disabled="true" align="right"/></td>
</tr>
</table><br/>
<input type="reset" value="Batal" />
</form>
</body>
</html>

Tidak ada komentar:

Posting Komentar