Recommended Servers - Topics UP



Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Autor Topic: Cuenta regresiva en HTML  (Visto 2936 veces)

0 Miembros and 1 Guest are viewing this topic.

Offline Azzlaer Posteado: July 15, 2017, 07:32:19 PM

  • MAESTRO

  • Colaborador
  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 1.276
  • Gracias recibida: 16996
  • cl
Hola TuServerMu les vengo a traer un ejemplo para que hagan sus cuentas regresivas en su servidor de MU.
Esto deben ponerlo en el lugar de donde quieren que se muestre, por lo general sino crean un bloc de notas y pegas este codigo y lo guardas como visor.html  y  ya podes visualizar la cuenta regresiva.

07 = MES
18 = DIA
17 = AÑO

Code: [Select]
<center><script language="JavaScript" type="text/javascript">
//<![CDATA[
TargetDate = "07/18/17 1:10 PM";
BackColor = "black";
ForeColor = "yellow";
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%% Dias, %%H%% Horas, %%M%% Minutos, %%S%% Segundos.";
FinishMessage = "Es hora de la guerra!!!";
//]]>
</script><script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js" type="text/javascript">
</script></center><center>


Offline Cacikus #1 Posteado: July 17, 2017, 04:13:05 AM

Gracias:


Offline Deidad #2 Posteado: February 24, 2019, 06:20:47 PM

  • Php Coder
  • 0 puntos por ventas
  • *
  • *
  • Rank: Puto amo
  • Posts: 686
  • Gracias recibida: 1016
  • ve
Hola mejore un poco el codigo.







contenido del countdown.js

Code: [Select]

function calcage(secs, num1, num2) {
  s = ((Math.floor(secs/num1))%num2).toString();
  if (LeadingZero && s.length < 2)
    s = "0" + s;
  return "<b>" + s + "</b>";
}

function CountBack(secs) {
  if (secs < 0) {
    document.getElementById("cntdwn").innerHTML = FinishMessage;
    return;
  }
  DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
  DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));

  document.getElementById("cntdwn").innerHTML = DisplayStr;
  if (CountActive)
    setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod);
}

function putspan(backcolor, forecolor) {
 document.write("<div id='cntdwn'></div>");
}

if (typeof(BackColor)=="undefined")
  BackColor = "white";
if (typeof(ForeColor)=="undefined")
  ForeColor= "black";
if (typeof(TargetDate)=="undefined")
  TargetDate = "12/31/2020 5:00 AM";
if (typeof(DisplayFormat)=="undefined")
  DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
if (typeof(CountActive)=="undefined")
  CountActive = true;
if (typeof(FinishMessage)=="undefined")
  FinishMessage = "";
if (typeof(CountStepper)!="number")
  CountStepper = -1;
if (typeof(LeadingZero)=="undefined")
  LeadingZero = true;


CountStepper = Math.ceil(CountStepper);
if (CountStepper == 0)
  CountActive = false;
var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990;
putspan(BackColor, ForeColor);
var dthen = new Date(TargetDate);
var dnow = new Date();
if(CountStepper>0)
  ddiff = new Date(dnow-dthen);
else
  ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
CountBack(gsecs);




Offline Alexsupra0 #3 Posteado: April 04, 2019, 06:44:47 PM

Esto sirve para cliente , files , web ? especificar porfavor.


Offline -Rastaa.TSM☢ #4 Posteado: April 04, 2019, 07:33:01 PM

  • MAESTRO

  • US. DE HONOR

  • Administrator
  • 0 puntos por ventas
  • *
  • *
  • Rank: Puto amo
  • Posts: 2.920
  • Gracias recibida: 20401
  • pk
 
Esto sirve para cliente , files , web ? especificar porfavor.
Pagina web amigo.


Offline adryan #5 Posteado: February 11, 2020, 12:35:30 PM

Hola mejore un poco el codigo.



 

contenido del countdown.js

Code: [Select]

function calcage(secs, num1, num2) {
  s = ((Math.floor(secs/num1))%num2).toString();
  if (LeadingZero && s.length < 2)
    s = "0" + s;
  return "<b>" + s + "</b>";
}

function CountBack(secs) {
  if (secs < 0) {
    document.getElementById("cntdwn").innerHTML = FinishMessage;
    return;
  }
  DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
  DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
  DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
  DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));

  document.getElementById("cntdwn").innerHTML = DisplayStr;
  if (CountActive)
    setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod);
}

function putspan(backcolor, forecolor) {
 document.write("<div id='cntdwn'></div>");
}

if (typeof(BackColor)=="undefined")
  BackColor = "white";
if (typeof(ForeColor)=="undefined")
  ForeColor= "black";
if (typeof(TargetDate)=="undefined")
  TargetDate = "12/31/2020 5:00 AM";
if (typeof(DisplayFormat)=="undefined")
  DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
if (typeof(CountActive)=="undefined")
  CountActive = true;
if (typeof(FinishMessage)=="undefined")
  FinishMessage = "";
if (typeof(CountStepper)!="number")
  CountStepper = -1;
if (typeof(LeadingZero)=="undefined")
  LeadingZero = true;


CountStepper = Math.ceil(CountStepper);
if (CountStepper == 0)
  CountActive = false;
var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990;
putspan(BackColor, ForeColor);
var dthen = new Date(TargetDate);
var dnow = new Date();
if(CountStepper>0)
  ddiff = new Date(dnow-dthen);
else
  ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
CountBack(gsecs);
perdon por revivir xd pero donde pego esto?


Offline cufa1 #6 Posteado: April 25, 2020, 11:39:37 PM

  • 0 puntos por ventas
  • *
  • Rank: Sup. destacado
  • Posts: 110
  • Gracias recibida: 11
  • ar
es muy difícil agregar esto?


Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Recommended Servers - Topics Bottom



 

Related Topics

  Subject / Started by Replies Last post
5 Replies
1055 Views
Last post October 12, 2017, 04:32:42 PM
by Aяcαиgєℓ
7 Replies
2002 Views
Last post April 28, 2020, 10:23:56 AM
by Lemaitre
3 Replies
667 Views
Last post June 01, 2018, 03:24:15 PM
by -Rastaa.TSM☢
3 Replies
2057 Views
Last post May 03, 2019, 12:30:20 PM
by Hessen
0 Replies
245 Views
Last post May 27, 2019, 09:42:59 PM
by TinchoZH