Advertisement
Guest User

Untitled

a guest
Jan 24th, 2015
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <link rel="stylesheet" type="text/css" href="left_side.css" />
  5.  
  6. <script language="JavaScript">
  7. function checklength(i){
  8. if (i<10)
  9. {i="0"+i;}
  10. return i;
  11. }
  12. function clock(){
  13. var now = new Date();
  14. var hours = checklength(now.getHours());
  15. var minutes = checklength(now.getMinutes());
  16. var seconds = checklength(now.getSeconds());
  17. var format = 0; //0=24 hour format, 1=12 hour format
  18. var time;
  19.  
  20. if (format == 1){
  21. if (hours >= 12){
  22. if (hours ==12){
  23. hours = 12;
  24. }else {
  25. hours = hours-12;
  26. }
  27. time=hours+':'+minutes+':'+seconds+' PM';
  28. }else if(hours < 12){
  29. if (hours ==0){
  30. hours=12;
  31. }
  32. time=hours+':'+minutes+':'+seconds+' AM';
  33. }
  34. }
  35. if (format == 0){
  36. time= hours+':'+minutes+':'+seconds;
  37. }
  38. document.getElementById("clock").innerHTML=time;
  39. setTimeout("clock();", 500);
  40. }
  41. </script>
  42.  
  43. </head>
  44. <body>
  45. <div id="sts2"><small><small><div id="clock"><script language="javascript">clock();</script></div></small></small></div>
  46. </body>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement