Actualisation périodique d'un script (toutes les 10s)
Bonjour,
Je souhaiterai faire tourner en boucle une fonction: affiche() (toute les 10 secondes) sans rafraichir la page HTML.
Est-ce possible?
Voilà mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
| <!DOCTYPE html>
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
var t = null;
function actualise()
{
affiche()
t = setInterval("affiche()",1000);
}
</SCRIPT>
</head>
<body bgColor=white onload="actualise()"> <!-- appelle de la fonction "affiche" au chargement de la page 'onload="affiche()"' -->
<SCRIPT>
for (i=0;i<2;i++)
{
var TabVoy=new Array("Vrouge.PNG","VVert.PNG","VGris.PNG");
}
<!-- Fonction pour charger le bon voyant dans "imagesN.src" en fonction de l'etat du bit -->
function affiche()
{
var CmtGF2 = ':="DB".CmtGF2.Marche:';
var RMCondenseurGF2 = ':="DB".GF2.RM_Condenseur:';
var RetMarcheGF2 = ':="DB".GF2.RetMarcheGf:';
var DefCondGF2 = ':="DB".GF2.Def_Condenseur:';
var DefGF2 = ':="DB".GF2.DefSynthese:';
var ManqueEauGF2 = ':="DB".PpeGF2.DefautDebitEau:';
var RetMarchePpe2 = ':="DB".PpeGF2.RetMarche:';
var DefautPpe2 = ':="DB".PpeGF2.DefautSynthese:';
if (CmtGF2==0) {document.getElementById("images1").src=TabVoy[2]}
else {document.getElementById("images1").src=TabVoy[1]};
if (RMCondenseurGF2==0) {document.getElementById("images2").src=TabVoy[2]}
else {document.getElementById("images2").src=TabVoy[1]};
if (RetMarcheGF2==0) {document.getElementById("images3").src=TabVoy[2]}
else {document.getElementById("images3").src=TabVoy[1]};
if (DefCondGF2==1) {document.getElementById("images4").src=TabVoy[0]}
else {document.getElementById("images4").src=TabVoy[2]};
if (DefGF2==1) {document.getElementById("images5").src=TabVoy[0]}
else {document.getElementById("images5").src=TabVoy[2]};
if (ManqueEauGF2==1) {document.getElementById("images6").src=TabVoy[0]}
else {document.getElementById("images6").src=TabVoy[2]};
if (RetMarchePpe2==0) {document.getElementById("images7").src=TabVoy[2]}
else {document.getElementById("images7").src=TabVoy[1]};
if (DefautPpe2==1) {document.getElementById("images8").src=TabVoy[0]}
else {document.getElementById("images8").src=TabVoy[2]};
}
</SCRIPT>
<font face="arial" color="2C3E50">
<H1 align=center><i> SYNTHESE GROUPE FROID 2 </i></H1>
<br><br>
<!-- Mise en forme dans un tableau avec insertion des voyants -->
<table width=100% style="font-size: 21px">
<TR>
<TD width=32%><ul><li> Commutateur Groupe Froid 2 </li></ul></TD>
<TD> <div id='dimage1'><img id='images1' width="40" height="40"></div> </TD>
<TD width=32%><ul><li> Retour de marche Condenseur 2 </li></ul></TD>
<TD> <div id='dimage2'><img id='images2' width="40" height="40"></div> </TD>
</TR>
<TR>
<TD width=32%><ul><li> Retour de marche Groupe Froid 2 </li></ul></TD>
<TD> <div id='dimage3'><img id='images3' width="40" height="40"></div> </TD>
<TD width=32%><ul><li> Retour de marche Pompe de charge 2 </li></ul></TD>
<TD> <div id='dimage7'><img id='images7' width="40" height="40"></div> </TD>
</TR>
<TR>
<TD width=32%><ul><li> Defaut Groupe Froid 2 </li></ul></TD>
<TD> <div id='dimage5'><img id='images5' width="40" height="40"></div> </TD>
<TD width=32%><ul><li> Defaut Condenseur 2 </li></ul></TD>
<TD> <div id='dimage4'><img id='images4' width="40" height="40"></div> </TD>
</TR>
<TR>
<TD width=32%><ul><li> Defaut Debit Eau Groupe Froid 2 </li></ul></TD>
<TD> <div id='dimage6'><img id='images6' width="40" height="40"></div> </TD>
<TD width=32%><ul><li> Defaut Pompe de charge 2 </li></ul></TD>
<TD> <div id='dimage8'><img id='images8' width="40" height="40"></div> </TD>
</TR>
</table>
</font>
</body>
</html> |