1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
| <!DOCTYPE html>
| <html lang="en">
| <head>
| <meta charset="UTF-8">
| <title>Title</title>
| <script src="../static/js/jquery/jquery-3.3.1.min.js"></script>
| </head>
| <body>
| <div id="ycq"></div>
| <button onclick="closeBtn()">关闭</button>
| <button onclick="openBtn()">开始</button>
| <button id="1" onclick="alt(1)">开始</button>
| </body>
| <script>
| // var abc = 1
| var i ;
| i="10"
| var a = true
| setInterval(()=>{
| addI();
| },1000)
| function addI() {
| if (a) {
| console.log("正在打印"+i++)
| }else {
| return;
| }
| }
| $("#ycq").html(i)
|
| function alt(e) {
| alert(e)
| }
|
|
| var arr=[]; //批量定义
| for(var i=0;i<5;i++){
| var index=i; //动态定义变量名
| arr[index]='value-'+i; //动态赋值
| }
| console.log(arr);
|
|
|
|
|
|
|
|
|
| function closeBtn() {
| console.log("暂停打印")
| a = false
| }
| function openBtn() {
| console.log("恢复打印")
| a = true
| }
| </script>
| </html>
|
|