<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script> function f1(){ console.log(1) } //创建一个定时器 setInterval('f1();', 2000); </script> </body> </html>