Advertisement
firmans7

hitung range

Jan 14th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Perhitungan</title>
  4. </head>
  5. <body>
  6. <div class="perhitungan">
  7.     <li>
  8.     <label for ="nama"> Harga :</label>
  9.   <input type="range" min="0" max="100" name="vol" id="vol" oninput="nilai(value)">
  10. <output for="vol" id="volume">0</output>
  11.  
  12. <script>
  13.     function nilai(vol) {
  14.         document.querySelector('#volume').value = vol;
  15.     }
  16. </script>
  17.     </li>
  18.     <li>
  19.     <label for ="jumlah"> Jumlah :</label>
  20.   <input type="range" min="0" max="100" name="vol1" id="vol1" oninput="nilai1(value)">
  21. <output for="vol1" id="volume1">0</output>
  22.  
  23. <script>
  24.     function nilai1(vol1) {
  25.         document.querySelector('#volume1').value = vol1;
  26.     }
  27. </script>
  28.     </li>
  29.     <li>
  30.     <label for ="total">= Total :</label>
  31.     <input type="text" name="" id="total">
  32.     </li>
  33.     </div>
  34.  
  35.     <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
  36.     <script type ="text/javascript">
  37.         $(".perhitungan").keyup(function(){
  38.             var vol = parseInt($("#vol").val())
  39.             var vol1 = parseInt($("#vol1").val())
  40.  
  41.             var total = vol * vol1;
  42.             $("#total").attr("value",total)
  43.  
  44.             });
  45.     </script>
  46. </body>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement