Foros del Web » Programando para Internet » Jquery »

Cambiar mensaje al finalizar

Estas en el tema de Cambiar mensaje al finalizar en el foro de Jquery en Foros del Web. Tengo una cuenta regresiva y todo funciona perfectamernte, pero NECESITO que cuando se termine el tiempo me muestre la la palabra "FINALIZADO" y no que ...
  #1 (permalink)  
Antiguo 02/02/2013, 18:46
 
Fecha de Ingreso: septiembre-2010
Mensajes: 78
Antigüedad: 13 años, 7 meses
Puntos: 0
Cambiar mensaje al finalizar

Tengo una cuenta regresiva y todo funciona perfectamernte, pero NECESITO que cuando se termine el tiempo me muestre la la palabra "FINALIZADO" y no que me muestre 00:00:00

aqui esta el codigo:

Código Javascript:
Ver original
  1. <script type="text/javascript" charset="utf-8">
  2. // Javascript
  3. $(function() {
  4.   var d, h, m, s;
  5.   $('div#clock').countdown(new Date(2015, 6, 28), function(event) {
  6.     var timeFormat = "%d day(s) %h:%m:%s"
  7.         $this = $(this);
  8.     switch(event.type) {
  9.       case "days":
  10.         d = event.value;
  11.         break;
  12.       case "hours":
  13.         h = event.value;
  14.         break;
  15.       case "minutes":
  16.         m = event.value;
  17.         break;
  18.       case "seconds":
  19.         s = event.value;
  20.         break;
  21.       case "finished":
  22.         $this.fadeTo('slow', 0.5);
  23.         break;
  24.     }
  25.     // Assemble time format
  26.     if(d > 0) {
  27.       timeFormat = timeFormat.replace(/\%d/, d);
  28.       timeFormat = timeFormat.replace(/\(s\)/, Number(d) == 1 ? '' : 's');
  29.     } else {
  30.       timeFormat = timeFormat.replace(/%d day\(s\)/, '');
  31.     }
  32.     timeFormat = timeFormat.replace(/\%h/, h);
  33.     timeFormat = timeFormat.replace(/\%m/, m);
  34.     timeFormat = timeFormat.replace(/\%s/, s);
  35.     // Display
  36.     $this.html(timeFormat);
  37.   });
  38. });
  39. </script>
  40.  
  41. <!-- HTML -->
  42. <div id="clock"></div>

Muchas Gracias
  #2 (permalink)  
Antiguo 03/02/2013, 04:20
 
Fecha de Ingreso: junio-2011
Mensajes: 17
Antigüedad: 12 años, 10 meses
Puntos: 1
Respuesta: Cambiar mensaje al finalizar

Puedes poner al final de todo, en la parte de "//Display", un if que controle el hecho de cuando la hora, minutos y segundos sean 0, que haga $this.html("La cuenta ha terminado");

No tengo tiempo para probarlo, pero espero que te sirva.

Un saludo.
  #3 (permalink)  
Antiguo 03/02/2013, 09:58
 
Fecha de Ingreso: septiembre-2010
Mensajes: 78
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: Cambiar mensaje al finalizar

Gracias pachoc pero no me ha funcionado ahora me muestra

00:00:00 sin el fadeTo. pero no me muestra la la palabra:

"La cuenta ha terminado"
  #4 (permalink)  
Antiguo 03/02/2013, 12:10
Avatar de emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 9 meses
Puntos: 1567
Respuesta: Cambiar mensaje al finalizar

Cita:
Iniciado por Mndrake Ver Mensaje
Tengo una cuenta regresiva y todo funciona perfectamernte, pero NECESITO que cuando se termine el tiempo me muestre la la palabra "FINALIZADO" y no que me muestre 00:00:00

aqui esta el codigo:

Código Javascript:
Ver original
  1. <script type="text/javascript" charset="utf-8">
  2. // Javascript
  3. $(function() {
  4.   var d, h, m, s;
  5.   $('div#clock').countdown(new Date(2015, 6, 28), function(event) {
  6.     var timeFormat = "%d day(s) %h:%m:%s"
  7.         $this = $(this);
  8.     switch(event.type) {
  9.       case "days":
  10.         d = event.value;
  11.         break;
  12.       case "hours":
  13.         h = event.value;
  14.         break;
  15.       case "minutes":
  16.         m = event.value;
  17.         break;
  18.       case "seconds":
  19.         s = event.value;
  20.         break;
  21.       case "finished":
  22.         $this.fadeTo('slow', 0.5);
  23.         break;
  24.     }
  25.     // Assemble time format
  26.     if(d > 0) {
  27.       timeFormat = timeFormat.replace(/\%d/, d);
  28.       timeFormat = timeFormat.replace(/\(s\)/, Number(d) == 1 ? '' : 's');
  29.     } else {
  30.       timeFormat = timeFormat.replace(/%d day\(s\)/, '');
  31.     }
  32.     timeFormat = timeFormat.replace(/\%h/, h);
  33.     timeFormat = timeFormat.replace(/\%m/, m);
  34.     timeFormat = timeFormat.replace(/\%s/, s);
  35.     // Display
  36.     $this.html(timeFormat);
  37.   });
  38. });
  39. </script>
  40.  
  41. <!-- HTML -->
  42. <div id="clock"></div>

Muchas Gracias
Y eso que se supone que es? jQuery, un plugin de jQuery?
que es countdonw() ?
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.
  #5 (permalink)  
Antiguo 03/02/2013, 13:48
 
Fecha de Ingreso: septiembre-2010
Mensajes: 78
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: Cambiar mensaje al finalizar

Hola emprear esta es la funcion:

Código Javascript:
Ver original
  1. (function($) {
  2.  
  3.   $.fn.countdown = function(toDate, callback) {
  4.     var handlers = ['seconds', 'minutes', 'hours', 'days', 'weeks', 'daysLeft'];
  5.    
  6.     function delegate(scope, method) {
  7.       return function() { return method.call(scope) }
  8.     }
  9.    
  10.     return this.each(function() {
  11.       // Convert
  12.       if(!(toDate instanceof Date)) {
  13.         if(String(toDate).match(/^[0-9]*$/)) {
  14.           toDate = new Date(toDate);
  15.         } else if( toDate.match(/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})\s([0-9]{1,2})\:([0-9]{2})\:([0-9]{2})/) ||
  16.             toDate.match(/([0-9]{2,4})\/([0-9]{1,2})\/([0-9]{1,2})\s([0-9]{1,2})\:([0-9]{2})\:([0-9]{2})/)
  17.             ) {
  18.           toDate = new Date(toDate);
  19.         } else if(toDate.match(/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})/) ||
  20.                   toDate.match(/([0-9]{2,4})\/([0-9]{1,2})\/([0-9]{1,2})/)
  21.                   ) {
  22.           toDate = new Date(toDate)
  23.         } else {
  24.           throw new Error("Doesn't seen to be a valid date object or string")
  25.         }
  26.       }
  27.      
  28.       var $this = $(this),
  29.           values = {},
  30.           lasting = {},
  31.           interval = $this.data('countdownInterval'),
  32.           currentDate = new Date(),
  33.           secondsLeft = Math.floor((toDate.valueOf() - currentDate.valueOf()) / 1000);
  34.      
  35.       function triggerEvents() {
  36.         // Evaluate if this node is included in the html
  37.         if($this.closest('html').length === 0) {
  38.           stop(); // Release the memory
  39.           dispatchEvent('removed');
  40.           return;
  41.         }
  42.         // Calculate the time offset
  43.         secondsLeft--;
  44.         if(secondsLeft < 0) {
  45.           secondsLeft = 0;
  46.         }
  47.         lasting = {
  48.           seconds : secondsLeft % 60,
  49.           minutes : Math.floor(secondsLeft / 60) % 60,
  50.           hours   : Math.floor(secondsLeft / 60 / 60) % 24,
  51.           days    : Math.floor(secondsLeft / 60 / 60 / 24),
  52.           weeks   : Math.floor(secondsLeft / 60 / 60 / 24 / 7),
  53.           daysLeft: Math.floor(secondsLeft / 60 / 60 / 24) % 7
  54.         }
  55.         for(var i=0; i<handlers.length; i++) {
  56.           var eventName = handlers[i];
  57.           if(values[eventName] != lasting[eventName]) {
  58.             values[eventName] = lasting[eventName];
  59.             dispatchEvent(eventName);
  60.           }
  61.         }
  62.         if(secondsLeft == 0) {
  63.           stop();
  64.           dispatchEvent('finished');
  65.         }
  66.       }
  67.       triggerEvents();
  68.      
  69.       function dispatchEvent(eventName) {
  70.         var event     = $.Event(eventName);
  71.         event.date    = new Date(new Date().valueOf() + secondsLeft);
  72.         event.value   = values[eventName] || "0";
  73.         event.toDate  = toDate;
  74.         event.lasting = lasting;
  75.         switch(eventName) {
  76.           case "seconds":
  77.           case "minutes":
  78.           case "hours":
  79.             event.value = event.value < 10 ? '0'+event.value.toString() : event.value.toString();
  80.             break;
  81.           default:
  82.             if(event.value) {
  83.               event.value = event.value.toString();
  84.             }
  85.             break;
  86.         }
  87.         callback.call($this, event);
  88.       }
  89.      
  90.       function stop() {
  91.         clearInterval(interval);
  92.       }
  93.  
  94.       function start() {
  95.         $this.data('countdownInterval', setInterval(delegate($this, triggerEvents), 1000));
  96.         interval = $this.data('countdownInterval');
  97.       }
  98.      
  99.       if(interval) stop();
  100.       start();
  101.     });
  102.   }
  103. })(jQuery);
  #6 (permalink)  
Antiguo 03/02/2013, 16:28
Avatar de emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 9 meses
Puntos: 1567
Busqueda Respuesta: Cambiar mensaje al finalizar

Código Javascript:
Ver original
  1. case "finished":
  2.     timeFormat = "tiempo expirado"; // agregar mensaje aqui
  3.     $this.fadeTo('slow', 0.5);
  4.     break;

Para la próxima integrá todo en un html, si no es como armar un rompecabezas

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.
  #7 (permalink)  
Antiguo 03/02/2013, 16:51
 
Fecha de Ingreso: septiembre-2010
Mensajes: 78
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: Cambiar mensaje al finalizar

Cita:
Iniciado por emprear Ver Mensaje
Código Javascript:
Ver original
  1. case "finished":
  2.     timeFormat = "tiempo expirado"; // agregar mensaje aqui
  3.     $this.fadeTo('slow', 0.5);
  4.     break;

Para la próxima integrá todo en un html, si no es como armar un rompecabezas

Saludos
Muchas Gracias Emprear, coloque el código tal me lo pusiste y me no funciono,

este es el codigo exacto que tengo :


Código Javascript:
Ver original
  1. $(function(){var d, h, m, s;$('div#clock').countdown(new Date(2013,01,20),function(event){var timeFormat = "%h:%m:%s"
  2. $this = $(this);switch(event.type){case "days":d = event.value;break;case "hours":h=event.value;break;case "minutes":
  3. m = event.value;break;case "seconds":s = event.value;break;case "finished":timeFormat = "tiempo expirado";$this.fadeTo('slow', 0.5);break;}
  4. if(d > 0){timeFormat = timeFormat.replace(/\%d/, d);timeFormat = timeFormat.replace(/\(s\)/, Number(d) == 1 ? '' : 's');
  5. }else{timeFormat = timeFormat.replace(/%d dia\(s\)/, '');}timeFormat = timeFormat.replace(/\%h/, h);
  6. timeFormat = timeFormat.replace(/\%m/, m);timeFormat = timeFormat.replace(/\%s/, s);$this.html(timeFormat);});});


Otra cosilla emprear por casualidad sabes porque a este srcript tengo que darle la fecha con un mes atras ejemplo si quiero que finalice el 2013-02-20 ( el 20 de febrero ) tengo que ponerle
2013-01-20 si no me funciona.

De Casualidad sabes como le podria agregar milisegundos a este countdown

Te agradezco mucho tu ayuda.
  #8 (permalink)  
Antiguo 03/02/2013, 17:05
Avatar de emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 9 meses
Puntos: 1567
Respuesta: Cambiar mensaje al finalizar

A mi me funciona
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>titulo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
  7. <script type="text/javascript">
  8. //<![CDATA[
  9. (function($) {
  10.  
  11.  $.fn.countdown = function(toDate, callback) {
  12.    var handlers = ['seconds', 'minutes', 'hours', 'days', 'weeks', 'daysLeft'];
  13.    
  14.    function delegate(scope, method) {
  15.      return function() { return method.call(scope) }
  16.    }
  17.    
  18.    return this.each(function() {
  19.      // Convert
  20.      if(!(toDate instanceof Date)) {
  21.        if(String(toDate).match(/^[0-9]*$/)) {
  22.          toDate = new Date(toDate);
  23.        } else if( toDate.match(/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})\s([0-9]{1,2})\:([0-9]{2})\:([0-9]{2})/) ||
  24.            toDate.match(/([0-9]{2,4})\/([0-9]{1,2})\/([0-9]{1,2})\s([0-9]{1,2})\:([0-9]{2})\:([0-9]{2})/)
  25.            ) {
  26.          toDate = new Date(toDate);
  27.        } else if(toDate.match(/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})/) ||
  28.                  toDate.match(/([0-9]{2,4})\/([0-9]{1,2})\/([0-9]{1,2})/)
  29.                  ) {
  30.          toDate = new Date(toDate)
  31.        } else {
  32.          throw new Error("Doesn't seen to be a valid date object or string")
  33.        }
  34.      }
  35.      
  36.      var $this = $(this),
  37.          values = {},
  38.          lasting = {},
  39.          interval = $this.data('countdownInterval'),
  40.          currentDate = new Date(),
  41.          secondsLeft = Math.floor((toDate.valueOf() - currentDate.valueOf()) / 1000);
  42.      
  43.      function triggerEvents() {
  44.        // Evaluate if this node is included in the html
  45.        if($this.closest('html').length === 0) {
  46.          stop(); // Release the memory
  47.          dispatchEvent('removed');
  48.          return;
  49.        }
  50.        // Calculate the time offset
  51.        secondsLeft--;
  52.        if(secondsLeft < 0) {
  53.          secondsLeft = 0;
  54.        }
  55.        lasting = {
  56.          seconds : secondsLeft % 60,
  57.          minutes : Math.floor(secondsLeft / 60) % 60,
  58.          hours   : Math.floor(secondsLeft / 60 / 60) % 24,
  59.          days    : Math.floor(secondsLeft / 60 / 60 / 24),
  60.          weeks   : Math.floor(secondsLeft / 60 / 60 / 24 / 7),
  61.          daysLeft: Math.floor(secondsLeft / 60 / 60 / 24) % 7
  62.        }
  63.        for(var i=0; i<handlers.length; i++) {
  64.          var eventName = handlers[i];
  65.          if(values[eventName] != lasting[eventName]) {
  66.            values[eventName] = lasting[eventName];
  67.            dispatchEvent(eventName);
  68.          }
  69.        }
  70.        if(secondsLeft == 0) {
  71.          stop();
  72.          dispatchEvent('finished');
  73.        }
  74.      }
  75.      triggerEvents();
  76.      
  77.      function dispatchEvent(eventName) {
  78.        var event     = $.Event(eventName);
  79.        event.date    = new Date(new Date().valueOf() + secondsLeft);
  80.        event.value   = values[eventName] || "0";
  81.        event.toDate  = toDate;
  82.        event.lasting = lasting;
  83.        switch(eventName) {
  84.          case "seconds":
  85.          case "minutes":
  86.          case "hours":
  87.            event.value = event.value < 10 ? '0'+event.value.toString() : event.value.toString();
  88.            break;
  89.          default:
  90.            if(event.value) {
  91.              event.value = event.value.toString();
  92.            }
  93.            break;
  94.        }
  95.        callback.call($this, event);
  96.      }
  97.      
  98.      function stop() {
  99.        clearInterval(interval);
  100.      }
  101.  
  102.      function start() {
  103.        $this.data('countdownInterval', setInterval(delegate($this, triggerEvents), 1000));
  104.        interval = $this.data('countdownInterval');
  105.      }
  106.      
  107.      if(interval) stop();
  108.      start();
  109.    });
  110.  }
  111. })(jQuery);
  112. //]]>
  113. <script type="text/javascript">
  114. //<![CDATA[
  115. $(document).ready(function(){
  116.  var d, h, m, s;
  117.  $('div#clock').countdown(new Date(2013, 01, 03,20,01), function(event) {
  118.    var timeFormat = "%d day(s) %h:%m:%s"
  119.        $this = $(this);
  120.    switch(event.type) {
  121.      case "days":
  122.        d = event.value;
  123.        break;
  124.      case "hours":
  125.        h = event.value;
  126.        break;
  127.      case "minutes":
  128.        m = event.value;
  129.        break;
  130.      case "seconds":
  131.        s = event.value;
  132.        break;
  133.      case "finished":
  134.  timeFormat = "tiempo expirado";
  135.        $this.fadeTo('slow', 0.5);
  136.        break;
  137.    }
  138.    // Assemble time format
  139.    if(d > 0) {
  140.      timeFormat = timeFormat.replace(/\%d/, d);
  141.      timeFormat = timeFormat.replace(/\(s\)/, Number(d) == 1 ? '' : 's');
  142.    } else {
  143.      timeFormat = timeFormat.replace(/%d day\(s\)/, '');
  144.    }
  145.    timeFormat = timeFormat.replace(/\%h/, h);
  146.    timeFormat = timeFormat.replace(/\%m/, m);
  147.    timeFormat = timeFormat.replace(/\%s/, s);
  148.    // Display
  149.    
  150.    $this.html(timeFormat);
  151.  
  152.  });
  153. });
  154. //]]>
  155. </script><!-- HTML -->
  156. </head>
  157. <div id="clock"></div>
  158. </body>
  159. </html>

Para tu script Enero = 00, Febrero = 01, etc....
Lo de los milisegundos, no se, no uso esos plugins

SAludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.
  #9 (permalink)  
Antiguo 03/02/2013, 19:08
 
Fecha de Ingreso: septiembre-2010
Mensajes: 78
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: Cambiar mensaje al finalizar

Cita:
Iniciado por emprear Ver Mensaje
A mi me funciona
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>titulo</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
  7. <script type="text/javascript">
  8. //<![CDATA[
  9. (function($) {
  10.  
  11.  $.fn.countdown = function(toDate, callback) {
  12.    var handlers = ['seconds', 'minutes', 'hours', 'days', 'weeks', 'daysLeft'];
  13.    
  14.    function delegate(scope, method) {
  15.      return function() { return method.call(scope) }
  16.    }
  17.    
  18.    return this.each(function() {
  19.      // Convert
  20.      if(!(toDate instanceof Date)) {
  21.        if(String(toDate).match(/^[0-9]*$/)) {
  22.          toDate = new Date(toDate);
  23.        } else if( toDate.match(/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})\s([0-9]{1,2})\:([0-9]{2})\:([0-9]{2})/) ||
  24.            toDate.match(/([0-9]{2,4})\/([0-9]{1,2})\/([0-9]{1,2})\s([0-9]{1,2})\:([0-9]{2})\:([0-9]{2})/)
  25.            ) {
  26.          toDate = new Date(toDate);
  27.        } else if(toDate.match(/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,4})/) ||
  28.                  toDate.match(/([0-9]{2,4})\/([0-9]{1,2})\/([0-9]{1,2})/)
  29.                  ) {
  30.          toDate = new Date(toDate)
  31.        } else {
  32.          throw new Error("Doesn't seen to be a valid date object or string")
  33.        }
  34.      }
  35.      
  36.      var $this = $(this),
  37.          values = {},
  38.          lasting = {},
  39.          interval = $this.data('countdownInterval'),
  40.          currentDate = new Date(),
  41.          secondsLeft = Math.floor((toDate.valueOf() - currentDate.valueOf()) / 1000);
  42.      
  43.      function triggerEvents() {
  44.        // Evaluate if this node is included in the html
  45.        if($this.closest('html').length === 0) {
  46.          stop(); // Release the memory
  47.          dispatchEvent('removed');
  48.          return;
  49.        }
  50.        // Calculate the time offset
  51.        secondsLeft--;
  52.        if(secondsLeft < 0) {
  53.          secondsLeft = 0;
  54.        }
  55.        lasting = {
  56.          seconds : secondsLeft % 60,
  57.          minutes : Math.floor(secondsLeft / 60) % 60,
  58.          hours   : Math.floor(secondsLeft / 60 / 60) % 24,
  59.          days    : Math.floor(secondsLeft / 60 / 60 / 24),
  60.          weeks   : Math.floor(secondsLeft / 60 / 60 / 24 / 7),
  61.          daysLeft: Math.floor(secondsLeft / 60 / 60 / 24) % 7
  62.        }
  63.        for(var i=0; i<handlers.length; i++) {
  64.          var eventName = handlers[i];
  65.          if(values[eventName] != lasting[eventName]) {
  66.            values[eventName] = lasting[eventName];
  67.            dispatchEvent(eventName);
  68.          }
  69.        }
  70.        if(secondsLeft == 0) {
  71.          stop();
  72.          dispatchEvent('finished');
  73.        }
  74.      }
  75.      triggerEvents();
  76.      
  77.      function dispatchEvent(eventName) {
  78.        var event     = $.Event(eventName);
  79.        event.date    = new Date(new Date().valueOf() + secondsLeft);
  80.        event.value   = values[eventName] || "0";
  81.        event.toDate  = toDate;
  82.        event.lasting = lasting;
  83.        switch(eventName) {
  84.          case "seconds":
  85.          case "minutes":
  86.          case "hours":
  87.            event.value = event.value < 10 ? '0'+event.value.toString() : event.value.toString();
  88.            break;
  89.          default:
  90.            if(event.value) {
  91.              event.value = event.value.toString();
  92.            }
  93.            break;
  94.        }
  95.        callback.call($this, event);
  96.      }
  97.      
  98.      function stop() {
  99.        clearInterval(interval);
  100.      }
  101.  
  102.      function start() {
  103.        $this.data('countdownInterval', setInterval(delegate($this, triggerEvents), 1000));
  104.        interval = $this.data('countdownInterval');
  105.      }
  106.      
  107.      if(interval) stop();
  108.      start();
  109.    });
  110.  }
  111. })(jQuery);
  112. //]]>
  113. <script type="text/javascript">
  114. //<![CDATA[
  115. $(document).ready(function(){
  116.  var d, h, m, s;
  117.  $('div#clock').countdown(new Date(2013, 01, 03,20,01), function(event) {
  118.    var timeFormat = "%d day(s) %h:%m:%s"
  119.        $this = $(this);
  120.    switch(event.type) {
  121.      case "days":
  122.        d = event.value;
  123.        break;
  124.      case "hours":
  125.        h = event.value;
  126.        break;
  127.      case "minutes":
  128.        m = event.value;
  129.        break;
  130.      case "seconds":
  131.        s = event.value;
  132.        break;
  133.      case "finished":
  134.  timeFormat = "tiempo expirado";
  135.        $this.fadeTo('slow', 0.5);
  136.        break;
  137.    }
  138.    // Assemble time format
  139.    if(d > 0) {
  140.      timeFormat = timeFormat.replace(/\%d/, d);
  141.      timeFormat = timeFormat.replace(/\(s\)/, Number(d) == 1 ? '' : 's');
  142.    } else {
  143.      timeFormat = timeFormat.replace(/%d day\(s\)/, '');
  144.    }
  145.    timeFormat = timeFormat.replace(/\%h/, h);
  146.    timeFormat = timeFormat.replace(/\%m/, m);
  147.    timeFormat = timeFormat.replace(/\%s/, s);
  148.    // Display
  149.    
  150.    $this.html(timeFormat);
  151.  
  152.  });
  153. });
  154. //]]>
  155. </script><!-- HTML -->
  156. </head>
  157. <div id="clock"></div>
  158. </body>
  159. </html>

Para tu script Enero = 00, Febrero = 01, etc....
Lo de los milisegundos, no se, no uso esos plugins

SAludos

Muchas Gracias emprear, ya me sirvio.

De casualidad sabes que debo cambiar para que enero sea 01 febrero 02 etc...

Muchísimas Gracias por tu ayuda.
  #10 (permalink)  
Antiguo 03/02/2013, 19:18
Avatar de emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 9 meses
Puntos: 1567
Respuesta: Cambiar mensaje al finalizar

Eso no te conviene ni tocarlo, para el objeto new Date() de js, el formato es año,mes,dia siendo meses 0 a 11
Ahora que si en un campo tenes mes 01,02,etc al pasar el valor a la función le restas 1

SAludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.
  #11 (permalink)  
Antiguo 03/02/2013, 22:25
 
Fecha de Ingreso: septiembre-2010
Mensajes: 78
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: Cambiar mensaje al finalizar

Cita:
Iniciado por emprear Ver Mensaje
Eso no te conviene ni tocarlo, para el objeto new Date() de js, el formato es año,mes,dia siendo meses 0 a 11
Ahora que si en un campo tenes mes 01,02,etc al pasar el valor a la función le restas 1

SAludos
Gracias emprear así lo hice jutamente con SUBDATE() le resto un mes.

Etiquetas: finalizar, funcion, html, javascript, mensaje
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:22.