- <HTML>
- <HEAD>
- <TITLE>Une horloge</TITLE>
- <STYLE>
- .style1 {
- background-color : Black;
- font-family : Arial, Helvetica, sans-serif;
- font-size : 20px;
- font-weight : bold;
- color : White;
- text-align : center;
- width : 250;
- }
- </STYLE>
- <SCRIPT LANGUAGE="Javascript">
- function ecritCalque(idCalque,texte)
- {
- if (document.all) document.all[idCalque].innerHTML = texte;
- if (document.layers)
- {
- document.layers[idCalque].document.open();
- document.layers[idCalque].document.write(texte);
- document.layers[idCalque].document.close();
- }
- if (document.getElementById)
- document.getElementById(idCalque).innerHTML = texte;
- }
- function creerCalque(idCalque,contenu,top,left,width,height,visibility)
- {
- if (document.layers)
- {
- document.layers[idCalque] = new Layer(width);
- document.layers[idCalque].top = top;
- document.layers[idCalque].left = left;
- document.layers[idCalque].width = width;
- document.layers[idCalque].height = height;
- document.layers[idCalque].visibility = visibility;
- document.layers[idCalque].document.open();
- document.layers[idCalque].document.write(contenu);
- document.layers[idCalque].document.close();
- }
- else
- {
- strDiv = "<DIV ID='"+idCalque+"' STYLE='position:absolute;top:"+top+"px;left:"+left+"px;width:"+width+";height:"+height+";visibility:"+visibility+"'>"+contenu+"</DIV>";
- document.body.innerHTML = document.body.innerHTML + strDiv;
- }
- }
- function horloge(classe,top,left,width,height)
- {
- creerCalque('calqueHorloge','',top,left,width,height,'visible');
- horlogeMot(classe);
- }
- function horlogeMot(classe)
- {
- dateAct = new Date();
- heure = dateAct.getHours();
- minute = dateAct.getMinutes();
- seconde = dateAct.getSeconds();
- if (minute < 10) minute = "0" + minute;
- if (seconde < 10) seconde = "0" + seconde;
- base = "<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD ALIGN='center' CLASS='"+classe+"' NOWRAP>";
- fin = "</TD></TR></TABLE>";
- texte = heure + " : " + minute + " : " + seconde;
- ecritCalque("calqueHorloge",base+texte+fin);
- setTimeout("horlogeMot('"+classe+"')",100);
- }
- </SCRIPT>
- </HEAD>
- <BODY onLoad="horloge('style1',100,100,250,30);">
-
- </BODY>
- </HTML>
<HTML>
<HEAD>
<TITLE>Une horloge</TITLE>
<STYLE>
.style1 {
background-color : Black;
font-family : Arial, Helvetica, sans-serif;
font-size : 20px;
font-weight : bold;
color : White;
text-align : center;
width : 250;
}
</STYLE>
<SCRIPT LANGUAGE="Javascript">
function ecritCalque(idCalque,texte)
{
if (document.all) document.all[idCalque].innerHTML = texte;
if (document.layers)
{
document.layers[idCalque].document.open();
document.layers[idCalque].document.write(texte);
document.layers[idCalque].document.close();
}
if (document.getElementById)
document.getElementById(idCalque).innerHTML = texte;
}
function creerCalque(idCalque,contenu,top,left,width,height,visibility)
{
if (document.layers)
{
document.layers[idCalque] = new Layer(width);
document.layers[idCalque].top = top;
document.layers[idCalque].left = left;
document.layers[idCalque].width = width;
document.layers[idCalque].height = height;
document.layers[idCalque].visibility = visibility;
document.layers[idCalque].document.open();
document.layers[idCalque].document.write(contenu);
document.layers[idCalque].document.close();
}
else
{
strDiv = "<DIV ID='"+idCalque+"' STYLE='position:absolute;top:"+top+"px;left:"+left+"px;width:"+width+";height:"+height+";visibility:"+visibility+"'>"+contenu+"</DIV>";
document.body.innerHTML = document.body.innerHTML + strDiv;
}
}
function horloge(classe,top,left,width,height)
{
creerCalque('calqueHorloge','',top,left,width,height,'visible');
horlogeMot(classe);
}
function horlogeMot(classe)
{
dateAct = new Date();
heure = dateAct.getHours();
minute = dateAct.getMinutes();
seconde = dateAct.getSeconds();
if (minute < 10) minute = "0" + minute;
if (seconde < 10) seconde = "0" + seconde;
base = "<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD ALIGN='center' CLASS='"+classe+"' NOWRAP>";
fin = "</TD></TR></TABLE>";
texte = heure + " : " + minute + " : " + seconde;
ecritCalque("calqueHorloge",base+texte+fin);
setTimeout("horlogeMot('"+classe+"')",100);
}
</SCRIPT>
</HEAD>
<BODY onLoad="horloge('style1',100,100,250,30);">
</BODY>
</HTML>