计时器练习

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.获取时间动起来的代码

猜你喜欢

转载自www.cnblogs.com/studybrother/p/10386195.html