Rabu, 18 September 2013

PHP Indonesia - Facebook: [ASK] saya mencoba membuat aplikasi perhitungan m...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
Refresh your vocabulary.

Learn a new word everyday by subscribing to Word of the Day. A great tool if you're studying for the GRE, GMAT or LSAT, or simply want to enhance your lexicon.
From our sponsors
[ASK] saya mencoba membuat aplikasi perhitungan m...
Sep 18th 2013, 17:54, by Andrew Chandra Raniello

Andrew Chandra Raniello 5:54pm Sep 18
[ASK]

saya mencoba membuat aplikasi perhitungan menggunakan event keyup jquery menggunakan "jquery-1.8.3.min.js",dimana fungsi dari event keyup disini apabila ada respon menggunakan keyboard maka fungsi yang ada didalamnya akan di laksanakan.
saya bingung ketika mencoba menampilkan secara otomatis pd text total knp ga da nilainya yah??, brikut codenya

<script src="jquery-1.8.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
function hitung() {
var harga = $("#harga").val();
var jumlah = $("#jumlah").val();
var trip = $("#trip").val();
var hrg_tiket = $("#hrg_tiket").val();
if(harga>0 && jumlah>0 && trip>0 && hrg_tiket>0){
var total = parseInt(harga)*parseInt(jumlah)*parseInt(trip)+parseInt(hrg_tiket);
$("#total").val(total);
diskon();
bonus();
}else{
$("#total").val('');
$("#diskon").val('');
$("#bonus").val('');
}
}
function diskon(){
var total = $("#total").val();
if(total>=500000){
var diskon = parseInt(total)*20/100;
$("#diskon").val(diskon);
}else if(total>=200000){
var diskon = parseInt(total)*15/100;
$("#diskon").val(diskon);
}else if(total>=100000){
var diskon = parseInt(total)*10/100;
$("#diskon").val(diskon);
}else if(total>=50000){
var diskon = parseInt(total)*5/100;
$("#diskon").val(diskon);
}else{
$("#diskon").val(0);
}
}
function bonus(){
var total = $("#total").val();
if(total>=500000){
var bonus = 'Tas Pinggang';
$("#bonus").val(bonus);
}else if(total>=200000){
var bonus = 'Payung';
$("#bonus").val(bonus);
}else if(total>=100000){
var bonus = 'Kaos';
$("#bonus").val(bonus);
}else if(total>=50000){
var bonus = 'Cangkir';
$("#bonus").val(bonus);
}else{
$("#bonus").val('Tidak Ada');
}
}
$("#harga").keyup(function(){
hitung();
});
$("#jumlah").keyup(function(){
hitung();
});
$("#trip").keyup(function(){
hitung();
});
$("#hrg_tiket").keyup(function(){
hitung();
});
});
</script>

mohon jawabannya dimana letak kesalahannya, trim's

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar