Senin, 07 Maret 2011

Tugas Praktikum Modul 4


Script:
pemesanan.js
function totalHarga(){
var harga;
var pesanan;
var total = 0;

for(i = 0; i < harga =" parseInt(document.pemesanan[i].value);" pesanan =" parseInt(document.pemesanan[i"> 0){
total = total + (harga * pesanan);
}

document.pemesanan.total.value = total;
}
}

function diskon(){
var total = parseInt(document.pemesanan.total.value);
var diskon = 0;

if(total >= 100000){
diskon = 20 / 100 * total;
}
else if(total >= 50000){
diskon = 10 / 100 * total;
}
else if(total >= 25000){
diskon = 5 / 100 * total;
}

document.pemesanan.diskon.value = diskon;
}

function jumlahBayar(){
var total = parseInt(document.pemesanan.total.value);
var diskon = parseInt(document.pemesanan.diskon.value);
var bayar = total - diskon;

document.pemesanan.bayar.value = bayar;
}

function proses(){
totalHarga();
diskon();
jumlahBayar();
}

function reset(){
var elemen = document.pemesanan;

elemen.pesan1.value = "";
elemen.pesan2.value = "";
elemen.pesan3.value = "";
elemen.pesan4.value = "";
elemen.pesan5.value = "";
elemen.total.value = "";
elemen.diskon.value = "";
elemen.bayar.value = "";
}

style pemesanan.css
body, header, section, footer{
width : 500px;
}

header, footer{
background-color : blue;
border-radius : 10px;
}

header{
padding-top : 10px;
height : 75px;
}

.title{
width : 450px;
font-style : italic;
background-color : rgba(255, 255, 255, 0.4);
border-bottom-right-radius : 30px;
border-top-left-radius : 30px;
}

section{
text-align : left;
}
footer{
color : white;
font-size : small;
height : 20px;
padding-top : 5px;
padding-bottom : 5px;
}


pemesanan.html
Form Pemesanan - Tugas Praktikum Modul 5
Form Pemesanan - Tugas Praktikum Modul 5 Printscreen:



Tidak ada komentar:

Posting Komentar