Write a dynamic clock on a web page in HTML

Write a dynamic clock on a web page in HTML

Use HTML to write a dynamic web clock. The code is as follows:

<!DOCTYPE html>  
<html>  
    <head>  
        <meta charset="UTF-8">  
        <title>Clock Effects</title>  
    </head>  
    <script type="text/javascript">  
        function disptime(){  
            var today = new Date();  
            var hh=today.getHours();  
            var mm=today.getMinutes();  
            var ss = today.getSeconds();  
            document.getElementById("myclock").innerHTML="<h1>Now is—"+hh+":"+mm+":"+ss+"</h1>"  
             
        }   
        //The setInterval() method can call a function or calculate an expression according to the specified period var mytime = setInterval("disptime()",1000);  
    </script>  
    <body onload="disptime()">  
        <div id="myclock"></div>  
    </body>  
</html>

Summarize

The above is what I introduced to you about writing a dynamic clock on a web page in HTML. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

<<:  JavaScript article will show you how to play with web forms

>>:  mysql method to recursively search for all child nodes of a menu node

Recommend

Database backup in docker environment (postgresql, mysql) example code

Table of contents posgresql backup/restore mysql ...

Implementation of master-slave replication in docker compose deployment

Table of contents Configuration parsing Service C...

A brief discussion on MySQL event planning tasks

1. Check whether event is enabled show variables ...

Implementation of grayscale release with Nginx and Lua

Install memcached yum install -y memcached #Start...

Vue realizes the function of uploading photos on PC

This article example shares the specific code of ...

Basic structure of HTML documents (basic knowledge of making web pages)

HTML operation principle: 1. Local operation: ope...

Use of Linux ifconfig command

1. Command Introduction The ifconfig (configure a...

A detailed tutorial on how to install Jenkins on Docker for beginners

Jenkins is an open source software project. It is...

CSS3 text animation effects

Effect html <div class="sp-container"...

Vue detailed explanation of mixins usage

Table of contents Preface 1. What are Mixins? 2. ...

Achieve 3D flip effect with pure CSS3 in a few simple steps

As a required course for front-end developers, CS...

How to invert the implementation of a Bezier curve in CSS

First, let’s take a look at a CSS carousel animat...

vue-table implements adding and deleting

This article example shares the specific code for...