Nie tag HTML nya, gw kasi dah.....
< br>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
function rst(){
var mf=document.form1;
mf.jm1.value="0"; mf.jm2.value="0"; mf.jm3.value="0";
mf.jm4.value="0"; mf.jm5.value="0"; mf.jt.value="0";
mf.dsc.value="0"; mf.bayar.value="0";
}
function proc(){
var mf=document.form1;
var hrg1=parseInt(mf.hg1.value) * parseInt(mf.jm1.value);
var hrg2=parseInt(mf.hg2.value) * parseInt(mf.jm2.value);
var hrg3=parseInt(mf.hg3.value) * parseInt(mf.jm3.value);
var hrg4=parseInt(mf.hg4.value) * parseInt(mf.jm4.value);
var hrg5=parseInt(mf.hg5.value) * parseInt(mf.jm5.value);
mf.jt.value=hrg1+hrg2+hrg3+hrg4+hrg5;
if (parseInt(mf.jt.value)>50000)
mf.dsc.value="10000";
mf.bayar.value=parseInt(mf.jt.value) - parseInt(mf.dsc.value);
}
//-->
</script>
<form name="form1" action="#" >
<table width="600" border="1">
<tr>
<th width="10%">No.</td>
<th width="40%">Makanan/Minuman</td>
<th width="30%">Harga</td>
<th width="20%">Pesan</td>
</tr>
<tr>
<td>1</td>
<td>Bakso Istimewa </td>
<td>@ <input name="hg1" type="text" id="hg1" value="12000" readonly="true" /></td>
<td><input name="jm1" type="text" id="jm1" value="0" onchange="proc(); " /></td>
</tr>
<tr>
<td>2</td>
<td>Soto Sepesial </td>
<td>@ <input name="hg2" type="text" id="hg2" value="10000" readonly="true" /></td>
<td><input name="jm2" type="text" id="jm2" value="0" onchange="proc(); " /></td>
</tr>
<tr>
<td>3</td>
<td>Mie Ayam Super </td>
<td>@ <input name="hg3" type="text" id="hg3" value="15000" readonly="true" /></td>
<td><input name="jm3" type="text" id="jm3" value="0" onchange="proc(); " /></td>
</tr>
<tr>
<td>4</td>
<td>Es Degan</td>
<td>@ <input name="hg4" type="text" id="hg4" value="5000" readonly="true" /></td>
<td><input name="jm4" type="text" id="jm4" value="0" onchange="proc(); " /></td>
</tr>
<tr>
<td>5</td>
<td>Es Campur </td>
<td>@ <input name="hg5" type="text" id="hg5" value="7000" readonly="true" /></td>
<td><input name="jm5" type="text" id="jm5" value="0" onchange="proc(); " /></td>
</tr>
<tr>
<td colspan="3" align="right">Jumlah Total </td>
<td><input name="jt" type="text" id="jt" value="0" readonly="true" /></td>
</tr>
<tr>
<td colspan="3" align="right">Diskon</td>
<td><input name="dsc" type="text" id="dsc" value="0" readonly="true" /></td>
</tr>
<tr>
<td colspan="3" align="right">Jimlah Dibayar </td>
<td><input name="bayar" type="text" id="bayar" value="0" readonly="true" /></td>
</tr>
</table>
<br>
<input type="submit" name="Submit" value="Batal" onclick="rst()" />
</form>
</body>
</html>
Read more!