bonsoir, j'ai un souci avec un compte rebours...
j'ai fixé la date et tt mais le soucic ke kan j'actualise la page, le compte a rebours se réinitialise..alors que j'ai besoin qu'il continue a s'écouler jusk a la date ou mon site va etre en ligne. ( je veux mettre un compte a rebours en attendant...). J'ai copié le scrpit sur un site mais je ne c pas comment l'adapter a mon souci.que faire?
voila le script :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml" xml:lang="fr-FR" lang="fr">
<head>
<title>Compte à rebours</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="fr" />
<script type="text/javascript" src="js/noframe.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" media="all" id="main-style" title="Style principal" lang="fr" />
<script type="text/javascript">
timer=null;
nbsec=0;
nbmin=0;
nbheure=0;
nbjour=0;
tsec=0;
rmin=0;
theure=0;
tjour=0;
strmillenaire="millenaire";
strsiecle="siecle";
stran="an";
strjour="jour";
strheure="heure";
strmin="minute";
strsec="seconde";
strpluriel="s";
strnow="M A I N T E N A N T";
strsensP="Reste : ";
strsensM="Il y a : ";
function FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas)
/**********************************************************************
IN:
NUM - the number to format
decimalNum - the number of decimal places to format the number to
bolLeadingZero - true / false - display a leading zero for
numbers between -1 and 1
bolParens - true / false - use parenthesis around negative numbers
bolCommas - put commas as number separators.
RETVAL:
The formatted number!
**********************************************************************/
{
if (isNaN(parseInt(num))) return "NaN";
var tmpNum = num;
var iSign = num < 0 ? -1 : 1; // Get sign of number
// Adjust number so only the specified number of numbers after
// the decimal point are shown.
tmpNum *= Math.pow(10,decimalNum);
tmpNum = Math.round(Math.abs(tmpNum))
tmpNum /= Math.pow(10,decimalNum);
tmpNum *= iSign; // Readjust for sign
// Create a string object to do our formatting on
var tmpNumStr = new String(tmpNum);
// See if we need to strip out the leading zero or not.
if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
if (num > 0)
tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length);
else
tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length);
// See if we need to put in the commas
if (bolCommas && (num >= 1000 || num <= -1000)) {
var iStart = tmpNumStr.indexOf(".");
if (iStart < 0)
iStart = tmpNumStr.length;
iStart -= 3;
while (iStart >= 1) {
tmpNumStr = tmpNumStr.substring(0,iStart) + " " + tmpNumStr.substring(iStart,tmpNumStr.length)
iStart -= 3;
}
}
// See if we need to use parenthesis
if (bolParens && num < 0)
tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")";
return tmpNumStr; // Return our formatted string!
}
function Pluriel(n,u){
if(n>1 && strpluriel!=''){
return u+strpluriel;
}else{
return u;
}
}
function Init(){
nbsec=4063262;
tmillenaire=0;
tsiecle=0;
ttan=0;
tjour=46;
theure=23;
tmin=18;
tsec=58;
sens='+';
if(timer!=null) clearInterval(timer);
timer=setInterval('OnTimer()', 1000);
return true;
}
function OnTimer(){
//nbsec--;
nbmin=nbsec / 60;
nbheure=nbsec / 3600;
nbjour=nbsec / 86400;
if(sens=='+') tsec--; else tsec++;
if(tsec<0){
tsec=59;
tmin--;
if(tmin<0){
tmin=59;
theure--;
if(theure<0){
theure=23;
tjour--;
if(tjour<0){
tjour=364;
ttan--;
if(ttan<0){
ttan=99;
tsiecle--;
if(tsiecle<0){
tsiecle=9;
tmillenaire--;
if(tmillenaire<0){
tmillenaire=0;
}
}
}
}
}
}
}
if(tsec>59){
tsec=0;
tmin++;
if(tmin>59){
tmin=0;
theure++;
if(theure>23){
theure=0;
tjour++;
}
}
}
if(tsec==0 && tmin==0 && theure==0 && tjour==0){
clearInterval(timer);
}
Affichage();
}
function Affichage(){
MyDiv=document.getElementById('strdate');
/*
MyDiv.innerHTML=FormatNumber(Math.round(nbjour),0,false,false,true)+' '+Pluriel(nbjour,strjour)+'
';
MyDiv.innerHTML+=FormatNumber(Math.round(nbheure),0,false,false,true)+' '+Pluriel(nbheure,strheure)+'
';
MyDiv.innerHTML+=FormatNumber(Math.round(nbmin),0,false,false,true)+' '+Pluriel(nbmin,strmin)+'
';
MyDiv.innerHTML+=FormatNumber(nbsec,0,false,false,true)+' '+Pluriel(nbsec,strsec)+'
';
*/
MyDiv.innerHTML='';
if(tjour==0 && theure==0 && tmin==0 && tsec==0){
MyDiv.innerHTML+=strnow;
}else{
if(sens=='+'){
MyDiv.innerHTML=strsensP;
}else{
MyDiv.innerHTML=strsensM;
}
if(tmillenaire>0) MyDiv.innerHTML+=tmillenaire+' '+Pluriel(tmillenaire,strmillenaire)+' ';
if(tsiecle>0) MyDiv.innerHTML+=tsiecle+' '+Pluriel(tsiecle,strsiecle)+' ';
if(ttan>0) MyDiv.innerHTML+=ttan+' '+Pluriel(ttan,stran)+' ';
if(tjour>0) MyDiv.innerHTML+=tjour+' '+Pluriel(tjour,strjour)+' ';
if(theure>0) MyDiv.innerHTML+=theure+' '+Pluriel(theure,strheure)+' ';
if(tmin>0) MyDiv.innerHTML+=tmin+' '+Pluriel(tmin,strmin)+' ';
if(tsec>0) MyDiv.innerHTML+=tsec+' '+Pluriel(tsec,strsec);
}
MyDiv.innerHTML+='';
}
</script>
<style type="text/css" media="all" lang="fr">
#ctn-form {
margin-left : auto;
margin-right : auto;
width : 80%;
}
#ctn-resultat {
margin-left : auto;
margin-right : auto;
width : 80%;
}
body,td,th {
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
body {
background-color: #333333;
background-image:url("THE BANG CORP IV/images/essaifond1.png");
}
.Style1 {
font-size: 36px;
font-weight: bold;
}
.Style5 {font-size: larger}
</style>
</head>
Lancement le
Vendredi 16 Mai 2008 18 h 00
<center>
Sois prêt !!
</center>
</html>
heeellp!!