Implementation of javascript timer

一个新手
Release: 2017-10-16 09:56:31
Original
1351 people have browsed it

    自动增长计时器  
  
Copy after login

Effect:

Display the current time and automatically grow

Add a timer for the button (for start and pause)

    计时器  
  
Copy after login

Effect:

#Click the start button to count from 0 and add 1 every second. Click the button to stop and maintain the current state.

Summary:

1. setInterval(code, interaction time);

Parameters: code: can be a function name or code string; interaction time: set the interaction time

clearInterval(id_from_setInterval);

Parameter: ID value returned by setInterval().

2. setTimeout (code, delay time);

Parameters: code: can be a function name or code string; delay time: set the delay time

clearTimeout (id_from_setTimeout) ;

Parameter: ID value returned by setTimeout().

The above is the detailed content of Implementation of javascript timer. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!