JSFiddle - React, Tailwind, and code Playground

by omar perez

HTML

<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script type="text/javascript" src="newjavascript.js"></script>
        <link rel="stylesheet" href="newcss.css" type="text/css" media="screen" />
    </head>
    <body>
        <div id="div"> </div>
        <div>
            <input type="button" value="INICIAR" onclick="ActivarTiempo()" id="boton" />
             <input type="button" value="PARAR" onclick="pararlo()" id="boton" />
        </div>
    </body>
</html>

CSS

body {
background-color: blue;
}

#boton {
color: yellow;
background-color: red;
}

#div {
  background-color: green;
  width: 200px;
  height: 200px;  
}

JavaScript

var parar;
var parar2;

function ActivarTiempo(){
        
        parar = setInterval("ocultar()",500);
        parar2 = setInterval("mostrar()",1000);
}
    
function ocultar() {
        document.getElementById('div').style.display="none";    
}
function mostrar() {
        document.getElementById('div').style.display="block";
        
}
function pararlo(){
	clearInterval(parar,parar2);
}