Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/09/2016, 01:48
leugimsiul
 
Fecha de Ingreso: mayo-2014
Mensajes: 44
Antigüedad: 10 años
Puntos: 10
Respuesta: Contador de descargas falso

Yo haría uso de setTimeout, por ejemplo, reciclando el código de alvaro_trewhela:


Código HTML:
Ver original
  1.     <head>
  2.         <script type="text/javascript">
  3.         function fakeCount(){
  4.                 var el = document.getElementById("count");
  5.                 el.innerHTML = parseInt(el.innerHTML)+1;
  6.                 var time = Math.round(Math.random()*3000); //número aleatorio entre 0 y 3000
  7.                 setTimeout("fakeCount()", time);
  8.         }
  9.         fakeCount();
  10.         </script>
  11.     </head>
  12.     <body>
  13.         Descargas: <span id="count">1</span>
  14.     </body>
  15. </html>