Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <script>
- function update(){
- hasil = document.getElementById("hasil");
- jumlah = document.getElementById("jumlah").value;
- harga = document.getElementById("harga").value;
- if(!isNaN(jumlah) && !isNaN(harga)){
- total = jumlah * harga;
- hasil.innerHTML = "Total = "+total;
- }else{
- alert("Inputan harus angka");
- }
- }
- </script>
- <head>
- <title>
- TES
- </title>
- </head>
- <body>
- Jumlah :<input type="text" id="jumlah" onblur="update()" value="0"><br/>
- Harga :<input type="text" id="harga" onblur="update()" value="0"><br/>
- <div id="hasil">
- 0
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement