<script type="text/javascript">
function displayDate(vr,i)
{
vr0=vr;
i0=i;
//1340827200
c=new Date();
sec=Math.floor(c.getTime() / (1000)); //getfromtimeseconds
razn=vr0-sec;
Data=new Array();
Data[0]=Math.floor(razn / 86400); //days
Data[1]=razn-(Data[0]*86400); // remainAfterDays
Data[2]=Math.floor((Data[1] / 3600)); //hours
Data[3]=Data[1]-(Data[2]*3600); //remainAfterHours
Data[4]=Math.floor((Data[3] / 60)); //minutes
Data[5]=Data[3]-(Data[4]*60); //RemainSeconds
Data[6]=Data[0]+Data[2]+Data[4]+Data[5];
if (Data[6] > 0) {
document.getElementById(id0).innerHTML=Data[0]+' Days '+Data[2]+':'+Data[4]+':'+Data[5];}
else {document.getElementById(id0).innerHTML='Акция завершилась';}
window.setTimeout("displayDate(vr0,id0)",1000);
}
function init(ttime,id)
{
ttime0=ttime;
id0=id;
window.setTimeout("displayDate(ttime0,id0)",1000);
}
function start() {
init(1340886000,'q');
init(1340886000,'h');
}
</script>
</head>
<body>
<h1>My First Web Page</h1>
<script>start();</script>
<p id="q">dsa</p>
<p id="h" >asd</p>