Home >Web Front-end >JS Tutorial >Dom learning summary and introduction to the use of examples_javascript skills
1. Re-navigate to the specified address: navigate("http://www.jb51.net");
2,
(1. *setInterval executes the specified code at intervals. The first parameter is the string of the code, the second parameter is the interval time (unit: milliseconds), and the return value is the identifier of the timer. For example:
setInterval("alert('hello')",5000);
*clearInterval cancels the scheduled execution of setInterval, which is equivalent to Enabled=False in Timer. Because setInterval can set multiple timings, clearInterval must specify the identifier of the timer to clear, which is the return value of setInterval.
var intervalld= setInterval("alert('hello')",5000);
clearInterval(intervalld);
(2. setTimeout is also a scheduled execution, but it is not a scheduled execution like setInterval. Instead, it is only executed once after setting the time. clearTimeout is also a clearing timing.
It is easy to distinguish: Interval is timing; Timeout is timeout.
var timeoutld=setTimeout("alert('hello')",2000);
(3. Case: Realizing the effect of title bar revolving door, that is, the browser's title text scrolls to the right every 500ms