|
@@ -0,0 +1,49 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html lang="en">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>Document</title>
|
|
|
+ <style>
|
|
|
+ .box{
|
|
|
+ width: 300px;
|
|
|
+ height: 300px;
|
|
|
+ background-color: #aaa;
|
|
|
+ box-shadow: 0 0 10px rgba(0,0,0,.5);
|
|
|
+ border-radius: 10px;
|
|
|
+ position: fixed;
|
|
|
+ top:50%;
|
|
|
+ left:50%;
|
|
|
+ margin-left: -150px;
|
|
|
+ margin-top: -150px;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 300px;
|
|
|
+ font-size: 40px;
|
|
|
+ font-weight: 500;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <div class="box">
|
|
|
+ <span>10</span>
|
|
|
+ </div>
|
|
|
+ <script>
|
|
|
+ var oSpan = document.getElementsByTagName("span");
|
|
|
+ var num = 10;
|
|
|
+
|
|
|
+ var setObj = setInterval(function(){
|
|
|
+ if(num == 0){
|
|
|
+ clearInterval(setObj);
|
|
|
+ }
|
|
|
+ oSpan[0].innerText = num--;
|
|
|
+ },1000);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // oSpan[0].innerText = "hello world";
|
|
|
+
|
|
|
+ // var arr = [1,2,3,4]
|
|
|
+ // arr[0] = "a"
|
|
|
+ </script>
|
|
|
+</body>
|
|
|
+</html>
|