The timer

  1. SetTimeout (function(){},ms)
  • ClearTimeout (t1)(ps:t1 is the timer name)
  • SetTimeout involves the task queue, when the timer set the number of milliseconds is 0, will not be executed immediately, will first put him in a task queue, to perform tasks on the main thread, the main thread after the task, check the timer task queue, if the specified waiting time, if to perform a task queue timer function
setTimeout(function(){// Async console.log(1)},0); console.log(2); console.log(3); <! The output is 2, 3, 1--> <! --setTimeout this method is used to start the timer as soon as the page is opened -->Copy the code
  1. SetInterval (function(){},ms)
  • Clear timer clearInterval(T1)

History Historical records

  1. History.forward () goes to the next page
  2. History.go (1) goes to the next page
  3. History.back () returns to the previous page
  4. History.go (-1) returns to the previous page
  5. Go (number) directly to the number page

A Label hop problem

  1. Don’t jump
  • href=”#”
  • href=”javascript:void(0)”
<a href="#">1</a></br>
<a href="javascript:void(0)">2</a></br>
Copy the code
  1. Jump to new page (original page still exists)
  • href=”www.baidu.com/” target=”_blank”
  <a href="https://www.baidu.com/" target="_blank"> baidu < / a > < / br >Copy the code