Download Fore_End/JavaScript/BOM/02_Window对象2.html from zxy0307/JavaWeb: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/zxy0307/JavaWeb/resolve/main/Fore_End/JavaScript/BOM/02_Window%E5%AF%B9%E8%B1%A12.html
- Command line
-
hf download hf://zxy0307/JavaWeb/Fore_End/JavaScript/BOM/02_Window对象2.html
-
curl -L -o 02_Window对象2.html https://huggingface.co/zxy0307/JavaWeb/resolve/main/Fore_End/JavaScript/BOM/02_Window%E5%AF%B9%E8%B1%A12.html
1.5 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Window对象</title> | |
| </head> | |
| <body> | |
| <script> | |
| /* | |
| 4、与定时器有关的方式 | |
| setTimeout() 在指定的毫秒数后调用函数或计算表达式。 | |
| * 参数: | |
| 1. js代码或者方法对象 | |
| 2. 毫秒值 | |
| * 返回值:唯一标识,用于取消定时器 | |
| clearTimeout() 取消由 setTimeout() 方法设置的 timeout。 | |
| setInterval() 按照指定的周期(以毫秒计)来调用函数或计算表达式。 | |
| clearInterval() 取消由 setInterval() 设置的 timeout。 | |
| */ | |
| //一次性的定时器 | |
| var id = setTimeout(fun, 2000); | |
| function fun(){ | |
| alert('boom~'); | |
| } | |
| clearTimeout(id);//取消执行 | |
| //循环定时器 | |
| var id2 = setInterval(fun, 5000); | |
| clearInterval(id2); | |
| /* | |
| 5、属性: | |
| 1. 获取其他BOM对象: | |
| history | |
| location | |
| Navigator | |
| Screen: | |
| 2. 获取DOM对象 | |
| document | |
| */ | |
| var h1 = window.history; | |
| alert(h1); | |
| window.document.write('BOM中的Window对象可以获取DOM中的document对象'); | |
| </script> | |
| </body> | |
| </html> |