Advertisement
justhrun

checkinout.html

Jan 10th, 2016
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.92 KB | None | 0 0
  1. <html><head><title>Checkin-Checkout</title>
  2. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  3. <script>
  4. $(document).ready( function() {
  5.     var chin = CheckDate( new Date(), 0);
  6.     $('#checkin').val( chin );
  7.     var chout = CheckDate( new Date(), 1);
  8.     $('#checkout').html( chout );
  9.  
  10.     $('#checkin,#malam').on('change', function() {
  11.         var checkin = $('#checkin').val().split('-');
  12.         var malam = parseInt($('#malam').val());
  13.         var dcheckin = new Date(checkin[0], checkin[1]-1, checkin[2]);
  14.         chout = CheckDate( dcheckin, malam);
  15.         $('#checkout').html( chout );
  16.     });
  17. });
  18.  
  19.     function CheckDate(chin, malam) {
  20.         if(chin=='Invalid Date') return '';
  21.         chin.setDate(chin.getDate()+malam);
  22.         var tgl = chin.getDate();
  23.         if(tgl<10) tgl = "0"+tgl;
  24.         var bln = chin.getMonth();
  25.         bln++;
  26.         if(bln<10) bln = "0"+bln;
  27.         var thn = chin.getFullYear();
  28.         return thn+'-'+bln+'-'+tgl;
  29.     }
  30. </script>
  31. </head>
  32. <body>
  33. </br></br>
  34. <center>
  35. <form>
  36.     Nama Lengkap :  <input type="text" name="nama"><br>
  37.     Tipe Kamar: <select name="tipekamar" id="tipekamar">
  38.         <option value="1">Presidential Suite</option>
  39.         <option value="2">Suite Room</option>
  40.         <option value="3">Junior Suite</option>
  41.         <option value="4">Deluxe</option>
  42.         <option value="5">Superior</option>
  43.         <option value="6">Standard</option>
  44.         </select><br>
  45.     Tanggal Check In :
  46.     <input type="date" id="checkin" name="checkin" style='font: bold 16px verdana; color:blue;'>
  47.     &nbsp; &nbsp;Jumlah Malam : <select name="malam" id="malam" style='font: bold 16px verdana;'>
  48.         <option value="1">1</option>
  49.         <option value="5">5</option>
  50.         <option value="9">9</option>
  51.         <option value="14">14</option>
  52.         <option value="22">22</option>
  53.         <option value="41">41</option>
  54.         </select>
  55.     &nbsp; &nbsp;Checkout:
  56.     <span id="checkout" style='font: bold 16px verdana; color:red;'></span><br>
  57.     <!--input type="submit" value="Submit"-->
  58. </form>
  59. </center>
  60. </body>
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement