<!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>TODO supply a title</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> var contador=0; var crono; function empezar(){ clearInterval(crono); crono=setInterval(cronometro,10); document.getElementById("pausar").style.display=""; document.getElementById("empezar").style.display="none"; } function parar(){ clearInterval(crono); document.getElementById("pausar").style.display="none"; document.getElementById("empezar").style.display=""; document.getElementById("empezar").value="Reanudar"; } function cronometro(){ contador++; document.getElementById("cronometro").innerHTML=contador/100; } </script> </head> <body> <h1 id="cronometro">Pulsa para empezar</h1> <input type="button" id="empezar" value="Empezar" onclick="empezar()"> <input type="button" id="pausar" value="Pausar" style="display:none" onclick="parar()"> </body> </html>