Código:
Les doy una imagen de como es, (aún no he echo el css ni nada, ya que no he solucionado como sacar la id)<html> <head> <title> DADO </title> <style type="text/css"> span {display: none;} button {display: block;} </style> <script type="text/javascript"> var VanillaRunOnDomReady = function() { var boton = document.getElementById("id_boton"), cuarz = document.getElementsByTagName("div"), total = cuarz.length, forEach = Array.prototype.forEach; boton.addEventListener("click", function () { var i = 0, intervalo = setInterval(function () { if ((i += 100) < 3000) { var posicion = Math.floor(Math.random() * total); forEach.call(cuarz, function (estilo) { estilo.style.display = estilo == cuarz[posicion] ? "block" : "none"; }); } else clearInterval(intervalo); }, 100); }, false); } var alreadyrunflag = 0; if (document.addEventListener) document.addEventListener("DOMContentLoaded", function(){ alreadyrunflag=1; VanillaRunOnDomReady(); }, false); else if (document.all && !window.opera) { document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>'); var contentloadtag = document.getElementById("contentloadtag") contentloadtag.onreadystatechange=function(){ if (this.readyState=="complete"){ alreadyrunflag=1; VanillaRunOnDomReady(); } } } window.onload = function(){ setTimeout("if (!alreadyrunflag){VanillaRunOnDomReady}", 0); } </script> </head> <body> <?php // VARIABLES DE IDS $a = ('ID '. 3); $b = ('ID '. 1); $c = ('ID '. 6); $d = ('ID '. 5); $f = ('ID '. 2); $g = ('ID '. 4); ?> <form action="" method="post"> <div name="b" style="display: none;"><?php echo $b; ?></div> <div style="display: none;"><?php echo $f; ?></div> <div style="display: none;"><?php echo $g; ?></div> <div style="display: none;"><?php echo $d; ?></div> <div style="display: none;"><?php echo $a; ?></div> <!-- Por defecto --> <div style="display: block;"><?php echo $c; ?></div> </form> <br> <button style="margin-left:20px;" type="submit" value="Lanzar Dado" name="button" id="id_boton">¡Lanzar!</button> </body></html>
