File tree 2 files changed +54
-0
lines changed
2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Title</ title >
6
+ < script type ="text/javascript ">
7
+ var num = 0 , i ;
8
+ function timedCount ( ) {
9
+ document . getElementById ( 'txt' ) . value = num ;
10
+ num = num + 1 ;
11
+ i = setTimeout ( timedCount , 1000 ) ;
12
+ }
13
+ setTimeout ( timedCount , 1000 ) ;
14
+ function stopCount ( ) {
15
+ clearTimeout ( i ) ;
16
+ }
17
+ </ script >
18
+ </ head >
19
+ < body >
20
+ < form >
21
+ < input type ="text " id ="txt ">
22
+ < input type ="button " value ="Stop " onclick ="stopCount() ">
23
+ </ form >
24
+ </ body >
25
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta http-equiv ="Content-Type " content ="text/html;charset=utf-8 "/>
5
+ < title > Title</ title >
6
+ </ head >
7
+ < body >
8
+ < h1 > 操作成功</ h1 >
9
+ < span id ="second "> 5</ span >
10
+ < span > 秒后返回到主页面</ span >
11
+ < a href ="javascript:back(); "> 返回</ a >
12
+
13
+ < script type ="text/javascript ">
14
+ var num = document . getElementById ( "second" ) . innerHTML ;
15
+ function count ( ) {
16
+ num -- ;
17
+ document . getElementById ( "second" ) . innerHTML = num ;
18
+ if ( num == 0 ) {
19
+ location . assign ( "https://www.baidu.com" ) ;
20
+ }
21
+ }
22
+ setInterval ( "count()" , 1000 ) ;
23
+ function back ( ) {
24
+ window . history . back ( ) ;
25
+ }
26
+ </ script >
27
+
28
+ </ body >
29
+ </ html >
You can’t perform that action at this time.
0 commit comments