Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title> HARGA TIKET PERTANDINGAN + PARKIR</title>
- <script>
- function inputan (){
- var txt1Value;
- var txt2Value;
- var total = document.getElementById('total').value;
- var bayar;
- var kembalian;
- txt1Value = document.getElementById('txt1').value;
- txt2Value = document.getElementById('txt2').value;
- if (!txt1Value) txt1Value=0 // Tambahan
- if (!txt2Value) txt2Value=0 // Tambahan
- total = parseInt(txt1Value) + parseInt(txt2Value);
- document.getElementById("total").value=total
- bayar = document.getElementById("bayar").value;
- kembalian = parseInt(bayar)-total; // Perubahan
- if (!kembalian) kembalian=0 // Tambahan
- document.getElementById("kembalian").value=kembalian; // Perubahan
- }
- </script>
- </head>
- <body>
- <label> PEMBAYARAN TIKET PERTANDINGAN + PARKIR </label>
- <form class="form-horizontal" action="" method="post">
- <div class="form-group">
- <label class="col-sm-3 control-label">LAMA PARKIR</label>
- <div class="col-sm-2">
- <select name="angkatan" class="form-control" onchange="document.getElementById('txt1').value=this.value;inputan ()" required>
- <option value="">--Pilih Waktu--</option>
- <option value="400">15 menit</option>
- <option value="500">20 Menit</option>
- <option value="1000">30 Menit</option>
- <option value="2500">1 Jam</option>
- <option value="3000">1 1/2 Jam</option>
- <option value="5000">2 Jam</option>
- </select>
- <input type="javascript" name="asal_halaman" id="txt1" onkeypress="inputan ();" />
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label">Pilih Tiket </label>
- <div class="col-sm-2">
- <select name="golongan" class="form-control" onchange="document.getElementById('txt2').value=this.value;inputan ()">
- <option value="">--Pilih Golongan--</option>
- <option value="400000">VIP</option>
- <option value="65000">Tribun tengah</option>
- <option value="50000" >Tribun Kanan</option>
- <option value="50000">Tribun Kiri</option>
- <option value="40000">Tribun Atas</option>
- </select>
- <input type="javascript" name="asal_halaman" id="txt2" onkeypress="inputan ();" />
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label">TOTAL BAYAR</label>
- <div class="col-sm-4">
- <!-- <input type="text" name="total" id="total" class="form-control" onkeypress="inputan ();" > -->
- <input type="text" name="total" id="total" class="form-control" disabled>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label">JUMLAH BAYAR</label>
- <div class="col-sm-2">
- <input type="text" name="bayar" class="form-control" id="bayar" onkeyup="inputan ();" placeholder="JUMLAH BAYAR">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label">KEMBALIAN</label>
- <div class="col-sm-2">
- <!-- <input type="text" id="kembalian" class="form-control" placeholder="HASIL" onkeypress="inputan ();"> -->
- <input type="text" id="kembalian" class="form-control" placeholder="HASIL" disabled>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label"> </label>
- <div class="col-sm-6">
- <input type="submit" name="add" class="btn btn-primary" value="TAMBAH">
- <a href="lihat_bayarspp.php" class="btn btn-warning">BATAL</a>
- </div>
- </div>
- </form>
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment