定时器

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    div {
        width: 600px;
        height: 100px;
        color: pink;
        border: 2px solid;
        margin: 200px auto;
        text-align: center;
        font-style: 20px;
        line-height: 100px;
        
    }
</style>
<script src="001.js"></script>//001.js是获取当前系统时间的js代码
<script>
    setInterval(function(){
        var odiv = document.getElementById("div1");
        odiv.innerHTML = showtime();
    },1000)
</script>
<body>
    <div id="div1"> 显示当前系统时间</div>
</body>
</html>
 
 

 

 

 

 

posted @ 2020-09-25 16:09  xxf2  阅读(136)  评论(0)    收藏  举报