Jump to content
alexarpad2003

javascript counter

Recommended Posts

Posted (edited)

Am urmatorul cod :

<script language="JavaScript">

TargetDate = "07/05/2011 11:30 PM";

ForeColor = "navy";

CountActive = true;

CountStepper = -1;

LeadingZero = true;

DisplayFormat = "%%D%% Zile, %%H%% Ore, %%M%% Minute, %%S%% Secunde";

FinishMessage = "It is finally here!";

</script>

<script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script>

Cum pot face ca sa-mi arate doar minutele ramase ?

Deci daca timpul de scurgere este de 2 ore de exemplu mie sa-mi arate 120 de minute si sa scada de acol, eventual si secundele pe alt rand, adica 7200 de secunde.

Am gasit, deci m-am grabit sa postez. Pun codu mai jos, poate are careva nevoie de el.

<script LANGUAGE="JavaScript">

var now = new Date();

var event = new Date("Jul 05 2011 12:00:00");

var seconds = (event - now) / 1000;

var minutes = seconds / 60;

var hours = minutes / 60;

var days = hours / 24;

ID=window.setTimeout("update();", 1000);

function update() {

now = new Date();

seconds = (event - now) / 1000;

seconds = Math.round(seconds);

minutes = seconds / 60;

minutes = Math.round(minutes);

hours = minutes / 60;

hours = Math.round(hours);

days = hours / 24;

days = Math.round(days);

document.form1.days.value = days;

document.form1.hours.value = hours;

document.form1.minutes.value = minutes;

document.form1.seconds.value = seconds;

ID=window.setTimeout("update();",1000);

}

</script>

<p><font face="Arial" size="3">xxx</font></p>

<form name="form1"><p><font face="Arial" size="2">Days <input type="text" name="days" value="0" size="3"> Hours

<input type="text" name="hours" value="0" size="4"> Minutes <input type="text" name="minutes" value="0"

size="7"> Seconds <input type="text" name="seconds" value="0" size="7"> </font> </p>

</form>

Nu mai face double post ! Next time , warn !

Edited by MrRip
Posted

Se putea mai simplu asa:

<script language="JavaScript">
TargetDate = "12/31/2020 5:00 AM";
BackColor = "palegreen";
ForeColor = "navy";
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
FinishMessage = "It is finally here!";
</script>
<script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script>

SURSA

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...