Тег <time></time>




Этот тег определяет дату и время.




index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  • </head>
  • <body>
  •  <div>
  •   <time id="t1"></time>
  •  </div>
  •  <script>
  •   function funTime() {
  •    var date = new Date();
  •    var hours = date.getHours();
  •    var minutes = date.getMinutes();
  •    var seconds = date.getSeconds();
  •    if(hours < 10) {
  •     hours = "0" + hours;
  •    }
  •    if(minutes < 10) {
  •     minutes = "0" + minutes;
  •    }
  •    if(seconds < 10) {
  •     seconds = "0" + seconds;
  •    }
  •    document.getElementById("t1").innerHTML = hours + ":" + minutes + ":" + seconds;
  •    setTimeout("funTime()", 1000);
  •   }
  •  
  •   funTime();
  •  
  •   $(document).ready(function () {
  •    $("*").css("margin", "0").css("padding", "0");
  •    $("div").css({ "width": "500px", "height": "500px", "position": "absolute", "left": "50%", "top": "50%", "margin-left": "-250px", "margin-top": "-250px", "text-align": "center", "line-height": "500px", "background-color": "#EEFCCD", "font-size": "50px" });
  •    $("time").css("background-color", "#f0f0f0");
  •   });
  •  </script>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  • </head>
  • <body>
  •  <div>
  •   <time id="t1"></time>
  •  </div>
  •  <script>
  •   function funTime() {
  •    var date = new Date();
  •    var hours = date.getHours();
  •    var minutes = date.getMinutes();
  •    var seconds = date.getSeconds();
  •    if(hours < 10) {
  •     hours = "0" + hours;
  •    }
  •    if(minutes < 10) {
  •     minutes = "0" + minutes;
  •    }
  •    if(seconds < 10) {
  •     seconds = "0" + seconds;
  •    }
  •    document.getElementById("t1").innerHTML = hours + ":" + minutes + ":" + seconds;
  •    setTimeout("funTime()", 1000);
  •   }
  •  
  •   funTime();
  •  
  •   $(document).ready(function () {
  •    $("*").css("margin", "0").css("padding", "0");
  •    $("div").css({ "width": "500px", "height": "500px", "position": "absolute", "left": "50%", "top": "50%", "margin-left": "-250px", "margin-top": "-250px", "text-align": "center", "line-height": "500px", "background-color": "#EEFCCD", "font-size": "50px" });
  •    $("time").css("background-color", "#f0f0f0");
  •   });
  •  </script>
  • </body>
  • </html>