time=0.000s
<!DOCTYPE html> <html lang="ja"> <head> <script type="text/javascript"> var st; function timer(){ st=+new Date(); hyouji(); } function hyouji(){ et=+new Date(); atai.innerHTML ="time="+eval(et-st)/1000+"s"; setTimeout(hyouji,10); } </script> <title>timer</title> </head> <body> <button onclick="timer()">push</button> <p id="atai">time=0.000s</p> </body> </html> |