3.window.js 672 B

123456789101112131415161718192021222324
  1. // window对象方法
  2. // 1.scrollTo(x,y)
  3. // 2.scrollBy(x,y)
  4. // 3.alert() 警告框 window.alert
  5. // 4.prompt("默认提示内容",默认内容) 输入框
  6. // prompt("请输入年级",18);
  7. // 5.confirm() 确认框
  8. // confirm("你好么")
  9. // 定时器
  10. // setInterval(执行的方法,间隔的时间)
  11. // 清除定时器 clearInterval()
  12. // document.getElementById("id名字")
  13. // document.getElementById("btn")
  14. // setTimeOut 延时器
  15. // clearTimeout() 清除延时器
  16. var btn = document.getElementById("btn");
  17. // console.log(btn)
  18. btn.onclick = function() {
  19. // console.log("打印")
  20. setTimeout(function(){
  21. console.log("打印")
  22. },3000)
  23. // clearTimeout()
  24. }