Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

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

0 Miembros and 1 Guest are viewing this topic.

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

  • MAESTRO

  • US. DE HONOR

  • Colaborador
  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 1.407
  • Gracias recibida: 23198
  • 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

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 475
  • Gracias recibida: 9999
  • ve
En HTML o JS? ^^

Gracias:


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

  • ESTAFADOR
  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 915
  • Gracias recibida: 1477
  • 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);



Gracias:

muextremo, kmikze22, DragonIsland, rulay, RyzenMu, fefe, rikigandur, tarikata, Zaabu, dmtuan23, sagamacus, Pocotoyo, rodriiigo, ChildOfGod, ldretrion, straiker23, rasta1999, vlons0, monarcalaghaim1, HazzdeN, sonytfm, aszxitalo, museven, extrememu, vipermu, webamoev, ronglovel, CezarMaster, ClouD95, jesuschis, JOnesTranqui, luca07, fallsmu, renansanx, sebastian, GOLERA, tecnomuonline, jose4090, Lorenz23453, portillourc1, zerolshen, gicorox, xunxolost, Cienfuegos22, davidmelo, andres1207, manugaby1, saphiromu, yuriizin, zoomame, Ratablanca, Vitaminka, makinorus, muonlineteste2, Noximus, psyqo, fivqt, DominicanO, Limadito, BURGAKIKE, matichile, ivanoidex, Dragonvl15, hector22, FuriaG, EzeQ, axeman192, waltervg91, jhorky91, Jospiter, VANHELSING, deportes97, Stament, jesuspiconc, MuArcano, lunaticodeveloper, MsotoC, crowalex14, DarkBot, Zahamael, mufenrir, daezugun, santiago2020, frankitoo_07, iMendoza, ailsoncost, peAace, murelics, madrynmu, NicoMura, mugoya2020, Darkyoo, alexfy, ales, matiman08, TzCr4ck, cufa1, MiRoKu, marvisur, joekio, enriquexp, alexpatel, toregz, loutlawl, francomilone, Leandro RS, c0d0m0, Broda, hedone, allhoy, Fragata, adryan, THOTH, ivois, Gaboo;, bravo99, JaenDenisa, xkennychix, mashemdq, ProyectoX, Erebo, Luks22xmu, hamiltonsl, toniex, dark, Baash, Kitty, rogeralexander, mamadusako, josuegreal, CristiaNN, sergio466, adryano, olivera10, narzuke16, Nexus, Zulus, SbaGomez, Yerko, fukpim, nscbr, piscis007, dark32, CAPITOL, answer, pablito91, frlcmd, Azzlaer, mcalbert1, ZabiinoOo, Yalc

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

  • 0 puntos por ventas
  • *
  • Rank: Dedicado
  • Posts: 31
  • Gracias recibida: 21
  • pe
Esto sirve para cliente , files , web ? especificar porfavor.


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

  • MAESTRO

  • US. DE HONOR

  • Super moderador
  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 883
  • Gracias recibida: 24984
  • ve
 
Esto sirve para cliente , files , web ? especificar porfavor.
Pagina web amigo.


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

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 350
  • Gracias recibida: 1194
  • ar
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?

Gracias:


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

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


Offline ClouD95 #7 Posteado: November 07, 2021, 08:03:27 PM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 5
  • Gracias recibida: 2
  • ar
Buenas gente, ya tengo mi webmu, la pregunta es la siguiente... como hago para agregar la cuenta regresiva ? guardo el archivo como visor.html y donde lo pego? por ejemplo mi web la tengo en la carpeta public_html lo pego ahi y ya deberia funcionar?.
   disculpen mi ignorancia, solo busco aprender un poco.
   Saludos


Offline cervino #8 Posteado: November 07, 2021, 08:17:39 PM

  • 0 puntos por ventas
  • *
  • Rank: Principiante
  • Posts: 7
  • Gracias recibida: 0
  • ar
en realidad es java xd pero buen aporte


Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate


 

Related Topics

  Subject / Started by Replies Last post
7 Replies
2932 Views
Last post April 28, 2020, 10:23:56 AM
by Lemaitre
2 Replies
1714 Views
Last post May 23, 2018, 12:17:06 PM
by 🐼 𝙋 𝘼 𝙉 𝘿 𝘼 🐼
3 Replies
1100 Views
Last post June 01, 2018, 03:24:15 PM
by -Rastaa.TSM☢
4 Replies
4249 Views
Last post November 09, 2021, 06:49:45 PM
by juanm
0 Replies
487 Views
Last post May 27, 2019, 09:42:59 PM
by TinchoZH