Div is not showing up

0

I'm trying to make one div appear right after the other, but when I put the function, only the first one disappear and the second does not appear.

<script>
    function apareceDiv1(){
 document.getElementById("est").style.display="block";

}
   function mostraHoras(){
    var hora = new Date();

    document.getElementById("segundos").innerHTML = hora.getSeconds();
}
    function apareceDiv2(){
 document.getElementById("est2").style.display="block";
}
    function fechaDiv1(){
        document.getElementById("est").style.display="none";
    }
    function apareceDiv3(){
 document.getElementById("est3").style.display="block";
}
    window.onload = function(){
        var cronometro = document.getElementById("cro");
        var fot = document.getElementById("fotos");
        var tabuada = document.getElementById("tab");

        setInterval(mostraHoras,1000);
        cronometro.onclick = apareceDiv1; mostraHoras;

        fot.onclick = fechaDiv1; apareceDiv2; 
        tabuada.onclick = apareceDiv3;


    }

    </script>
</head>
    
asked by anonymous 25.09.2017 / 01:36

1 answer

0

Simple, onclick you are acquiring 2 values erroneously so fot.onclick = dateDiv1; appearsDiv2; this does not work, create an onclick function looks much better, it will stay waiting to receive click, when receive executes the desired functions, the way you were doing would only run the first one because you ended with a ";" And look at her if it's just that. Any questions just talk

so

<script>
    function apareceDiv1(){
 document.getElementById("est").style.display="block";

}
   function mostraHoras(){
    var hora = new Date();

    document.getElementById("segundos").innerHTML = hora.getSeconds();
}
    function apareceDiv2(){
 document.getElementById("est2").style.display="block";
}
    function fechaDiv1(){
        document.getElementById("est").style.display="none";
    }
    function apareceDiv3(){
 document.getElementById("est3").style.display="block";
}
    window.onload = function(){
        var cronometro = document.getElementById("cro");
        var fot = document.getElementById("fotos");
        var tabuada = document.getElementById("tab");

        setInterval(mostraHoras,1000);

 cronometro.addListener('click', function() {
   apareceDiv1();
   mostraHoras();
});

fot.addListener('click', function() {
  fechaDiv1();
  apareceDiv2();
});

  tabuada.addListener('click', function() {
    apareceDiv3();
});

    }

    </script>
    
25.09.2017 / 15:18