Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  5. <title>End After Start</title>
  6. <script type="text/javascript">
  7. function datestart(value){
  8. document.getElementById("date_end").value = value;
  9. }
  10. function dateend(value){
  11. var vdatestart = document.getElementById("date_start").value;
  12. if (value<vdatestart){
  13. document.getElementById("date_end").value = vdatestart;
  14. }
  15. }
  16. </script>
  17. <style>
  18. .col-30 {
  19. float: left;
  20. width: 30%;
  21. margin-top: 6px;
  22. }
  23. .col-70 {
  24. float: left;
  25. width: 70%;
  26. margin-top: 6px;
  27. }
  28. .container {
  29. border-radius: 5px;
  30. background-color: #f2f2f2;
  31. padding: 20px;
  32. }
  33. .row:after {
  34. display: table;
  35. clear: both;
  36. }
  37. </style>
  38. </head>
  39. <body>
  40. <?php
  41. $datemin = '2018-05-01T00:00';
  42. $datemax = '2018-05-22T08:00';
  43. $currentdate = '2018-05-22T08:00';
  44. ?>
  45. <div class="container">
  46. <form name="form1" action="datetime1.php" method = "post">
  47.  
  48. <div class="row">
  49. <div class="col-30">
  50. <label>Start Date and Time from Start:</label>
  51. </div>
  52. <div class="col-70">
  53. <input type='datetime-local' name='date_start' id='date_start' min='<?php echo $datemin; ?>' max='<?php echo $datemax; ?>' required value='<?php echo $currentdate; ?>' onchange="datestart(this.value);" onclick="datestart(this.value);" />
  54. </div>
  55. </div>
  56. <div class="row">
  57. <div class="col-30">
  58. <label>End Date and Time:</label>
  59. </div>
  60. <div class="col-70">
  61. <input type='datetime-local' name='date_end' id='date_end' min='<?php echo $datemin; ?>' max='<?php echo $datemax; ?>' required value='<?php echo $currentdate; ?>' onchange="dateend(this.value);" onclick="dateend(this.value);" />
  62. </div>
  63. </div>
  64. <div class="row">
  65. <input type="submit" name="submit" value="Send">
  66. </div>
  67.  
  68.  
  69. </form>
  70. </div>
  71. </body>
  72. </html>
  73.  
  74. <!doctype html>
  75. <html lang="en">
  76. <head>
  77. <meta charset="utf-8">
  78. <title>submit demo</title>
  79. <style>
  80. p {
  81. margin: 0;
  82. color: blue;
  83. }
  84. div,p {
  85. margin-left: 10px;
  86. }
  87. span {
  88. color: red;
  89. }
  90. </style>
  91. <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
  92. </head>
  93. <body>
  94.  
  95. <p>Type 'correct' to validate.</p>
  96. <form action="javascript:alert( 'success!' );">
  97. <div>
  98. <input type="text" id="dataIni">
  99. <input type="text" id="dataFim">
  100. <input type="submit">
  101. </div>
  102. </form>
  103. <span></span>
  104.  
  105.  
  106. <script>
  107. $("form").submit(function(event) {
  108. if ($("#dataIni").val() < $("#dataFim").val()) {
  109. $("span").text("Validated...").show();
  110. return;
  111. }
  112.  
  113. $("span").text("Not valid!").show().fadeOut(1000);
  114. event.preventDefault();
  115. });
  116. </script>
  117.  
  118. </body>
  119. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement