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

Several ways to change MySQL password

Preface: In the daily use of the database, it is ...

Implementation of static website layout in docker container

Server placement It is recommended to use cloud s...

JavaScript Basics: Immediate Execution Function

Table of contents Immediately execute function fo...

MySql Sql optimization tips sharing

One day I found that the execution speed of a SQL...

Use momentJs to make a countdown component (example code)

Today I'd like to introduce a countdown made ...

How to quickly log in to MySQL database without password under Shell

background When we want to log in to the MySQL da...

Vue implements internationalization of web page language switching

1. Basic steps 1: Install yarn add vue-i18n Creat...

Complete steps to use element in vue3.0

Preface: Use the element framework in vue3.0, bec...

Detailed explanation of loop usage in javascript examples

I was bored and sorted out some simple exercises ...

Linux uses shell scripts to regularly delete historical log files

1. Tools directory file structure [root@www tools...

Complete steps to configure IP address in Ubuntu 18.04 LTS

Preface The method of configuring IP addresses in...

mysql show simple operation example

This article describes the mysql show operation w...

How to run multiple MySQL instances in Windows

Preface In Windows, you can start multiple MySQL ...

How to manage docker through UI

Docker is being used in more and more scenarios. ...

The difference between ENTRYPOINT and CMD in Dockerfile

In the Docker system learning tutorial, we learne...