计时器练习

Posted studybrother

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了计时器练习相关的知识,希望对你有一定的参考价值。

1.获取当前时间的代码,时间显示在input窗口里边.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="content-Type" charset="UTF-8">
    <meta http-equiv="x-ua-compatible" content="IE=edge">
    <title>Title</title>
</head>
<body>

<input type="text" id="i1">
<script>
    var i1Ele=document.getElementById(i1);
    var now=new Date();
    i1Ele.value=now.toLocaleString();
</script>
<!--获取当前时间的代码-->
</body>
</html>

 结果显示:

技术图片

 

2.获取时间动起来的代码

以上是关于计时器练习的主要内容,如果未能解决你的问题,请参考以下文章