label pembayaran with Javascript


to the point ajah yow...
this is the examples, n source codenya:

<em><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Queen's Cafe</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {color: #0099FF}
.style3 {color: #0000FF}
.style4 {color: #FF9900}
.style5 {color: #FF0000}
.style7 {
color: #FF0000;
font-size: 9px;
font-weight: bold;
}
.style9 {
color: #A4C931;
font-weight: bold;
font-style: italic;
font-size: 9px;
}
.style10 {
color: #CCCCCC;
font-weight: bold;
}
.style11 {color: #0C0082}
-->
</style>

<!fungsi matematis tabel>
<script language = "JavaScript" type="text/JavaScript">
<!--
function cafe()
{
var catat = document.formcafe;
var hargabakso = parseInt(catat.ba.value) * parseInt(catat.soaa.value);
var hargarokok = parseInt(catat.rok.value) * parseInt(catat.rokokaa.value);
var hargaminumanbotol= parseInt(catat.mb.value) * parseInt(catat.minaa.value);
var hargakue = parseInt(catat.ku.value) * parseInt(catat.kueaa.value);
var hargamie= parseInt(catat.mi.value) * parseInt(catat.mieaa.value);
var total = hargabakso + hargarokok + hargaminumanbotol+ hargakue + hargamie;
if (total > 50000)
{
catat.TotalBayar.value = total;
catat.Diskon.value = 10000;
catat.JumlahBayar.value = total - parseInt(catat.Diskon.value);
}
else
{
catat.TotalBayar.value = total;
catat.Diskon.value = 0;
catat.JumlahBayar.value = total;
}
}
function start(){
document.formcafe.reset();
}
//-->
</script>
</head>


<body>
<h2 style="text-align:center; color: black;" class="style1" >QUEEN's Cafe </h2>
<form name="formcafe" action="#">
<table width="480" border="2" align="center" style="border-">
<tr bgcolor="violet">
<th><span class="style10">No</span></th>
<th><span class="style10">Daftar Menu </span></th>
<th><span class="style10">Harga</span></th>
<th><span class="style10">Order</span></th>
</tr>
<tr>
<td width="27"><div style="text-align:center"><strong>1.</strong></div></td>
<td width="181"><strong>Bakso</strong></td>
<td width="118" ><strong>@
<input type="text" name="ba" value="5000" size="10" disabled="disabled">
</strong></td>
<td width="124" ><input name="soaa" type="text" onkeyup="cafe()" value="0" size="20"></td>
</tr>
<tr style="background-color:violet">
<td><div style="text-align:center"><strong>2.</strong></div></td>
<td><strong>Rokok</strong></td>
<td><strong>@
<input type="text" name="rok" value="10000" size="10" disabled="disabled">
</strong></td>
<td><input name="rokokaa" type="text" onkeyup="cafe()" value="0" size="20"></td>
</tr>
<tr>
<td><div style="text-align:center"><strong>3.</strong></div></td>
<td><strong>Minuman </strong></td>
<td><strong>@
<input type="text" name="mb" value="5000" size="10" disabled="disabled">
</strong></td>
<td><input name="minaa" type="text" onkeyup="cafe()" value="0" size="20"></td>
</tr>
<tr style="background-color:violet">
<td><div style="text-align:center"><strong>4.</strong></div></td>
<td><strong>Kue</strong></td>
<td><strong>@
<input type="text" name="ku" value="2500" size="10" disabled="disabled">
</strong></td>
<td><input name="kueaa" type="text" onkeyup="cafe()" value="0" size="20"></td>
</tr>
<tr>
<td><div style="text-align:center"><strong>5.</strong></div></td>
<td><strong>Mie</strong></td>
<td><strong>@
<input type="text" name="mi" value="6000" size="10" disabled="disabled">
</strong></td>
<td><input name="mieaa" type="text" onkeyup="cafe()" value="0" size="20"></td>
</tr>
<tr style="background-color:blue">
<td colspan="3"><div style="text-align:center">
<div align="center"><strong>Total </strong></div>
</div></td>
<td><input name="TotalBayar" type="text" style="text-align:center" disabled="disabled" value="-" size="20"></td>
</tr>
<tr style="background-color:blue">
<td colspan="3"><div style="text-align:center">
<div align="center"><strong>Diskon )*</strong></div>
</div></td>
<td><input name="Diskon" type="text" style="text-align:center" disabled="disabled" value="-" size="20"></td>
</tr>
<tr style="background-color:yellow">
<td colspan="3"><div style="text-align:center">
<div align="center"><strong>Jumlah Pembayaran </strong></div>
</div></td>
<td><input name="JumlahBayar" type="text" style="text-align:center" disabled="disabled" value="-" size="20"></td>
</tr>
</table>
<p style="text-align:center">&nbsp;</p>
<p style="text-align:center"><span class="style14">)* </span><span class="style15">:<span class="style16"> <span class="style17">Menunjukkan Jumlah potongan dikarenakan Pemesanan telah melebihi Rp. 50.000,00. Potongan tidak berlaku kelipata</span>n</span></span> <br/>
</p>
<div id="Layer1" style="position:absolute; width:63px; height:23px; z-index:1; left: 600px; top: 326px;">
<input name="button" type="button" onclick="start()" value="B A T A L" size="15">
</div>
</form>
</body>
</html>

</em>

let's get it.....good luck!

0 komentar:

Posting Komentar