option select time


/ Published in: HTML
Save to your folder(s)

smaller script for selecting a time


Copy this code and paste it in your HTML
  1.  
  2. <script type="text/javascript">
  3. var timetext=['5:00AM','5:15 AM','5:30 AM','5:45 AM','6:00AM','6:15 AM','6:30 AM','6:45 AM','7:00AM','7:15 AM','7:30 AM','7:45 AM','8:00AM','8:15 AM','8:30 AM','8:45 AM','9:00AM','9:15 AM','9:30 AM','9:45 AM','10:00AM','10:15 AM','10:30 AM','10:45 AM','11:00AM','11:15 AM','11:30 AM','11:45 AM','12:00PM','12:15 PM','12:30 PM','12:45 PM','1:00PM','1:15 PM','1:30 PM','1:45 PM','2:00PM','2:15 PM','2:30 PM','2:45 PM','3:00PM','3:15 PM','3:30 PM','3:45 PM','4:00PM','4:15 PM','4:30 PM','4:45 PM','5:00PM','5:15 PM','5:30 PM','5:45 PM','6:00PM','6:15 PM','6:30 PM','6:45 PM','7:00PM','7:15 PM','7:30 PM','7:45 PM','8:00PM','8:15 PM','8:30 PM','8:45 PM','9:00PM','9:15 PM','9:30 PM','9:45 PM','10:00PM','10:15 PM','10:30 PM','10:45 PM','11:00PM','11:15 PM','11:30 PM','11:45 PM'];
  4.  
  5. function populatedropdown(timefield){
  6. var timefield=document.getElementById(timefield)
  7. for (var m=0; m<76; m++)
  8. timefield.options[m]=new Option(timetext[m], timetext[m])
  9. }
  10.  
  11. </head>
  12.  
  13. <select id="timedropdown">
  14. </select>
  15.  
  16.  
  17. <script type="text/javascript">
  18. //populatedropdown(id_of_time_select)
  19. window.onload=function(){
  20. populatedropdown("timedropdown")
  21. }
  22.  
  23.  
  24. </body>
  25. </html>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.