恶心的定时器弹窗
今天学了js定时器,真的感觉好烦,可能是时间设置太小了吧,最后还是设置成5s好了
代码:
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>定时器</title> </head> <body> <script type = "text/javascript"> //一直被执行的函数 function showTime(){ var time = new Date(); alert(time.toLocaleString()); } //第一个参数是字符串,是调用的函数 //第二个参数是时间,毫秒 window.setInterval("showTime()",5000); </script> </body> </html>