Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1876 connectés 

  FORUM HardWare.fr
  Programmation
  HTML/CSS

  Probleme d'afficheage de mon horloge

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Probleme d'afficheage de mon horloge

n°2295241
hyogas
Posté le 26-01-2017 à 11:07:59  profilanswer
 

Bonjour,
 
Je laisse ce message car j'ai un soucis avec mon horloge. En effet l'heure n'apparait plus pouvez vous m'aider à trouver la raison du problème merci d'avance ?
Voici le code que j'utilise :  
 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Horloge</title>
<SCRIPT LANGUAGE="JavaScript">
navvers = navigator.appVersion.substring(0,1);
if (navvers > 3)
 navok = true;
else
 navok = false;
 
today = new Date;
numero = today.getDate();
if (numero<10)
 numero = "0"+numero;
mois = today.getMonth();
if (navok)
 annee = today.getFullYear();
else
 annee = today.getYear();
mois++;
if (mois < 10)
 mois = "0" + mois;
messageDate = numero + "/" + mois + "/" + annee;
function HeureCheck()
{
krucial = new Date;
heure = krucial.getHours();
min = krucial.getMinutes();
sec = krucial.getSeconds();
jour = krucial.getDate();
mois = krucial.getMonth()+1;
annee = krucial.getFullYear();
if (sec < 10)
sec0 = "0";
else
sec0 = "";
if (min < 10)
min0 = "0";
else
min0 = "";
if (heure < 10)
heure0 = "0";
else
heure0 = "";
DinaHeure = heure0 + heure + ":" + min0 + min + ":" + sec0 + sec;
which = DinaHeure
if (document.all){
dynamic3.innerHTML='<center>00:00:00</center>'
dynamic3.innerHTML='<FONT SIZE=2 FACE=" comic sans ms black "><B>'+which+'</B></FONT>';
}
else if (document.layers){
document.dynamic1.document.dynamic2.document.write(''+which+'')
document.dynamic1.document.dynamic2.document.close()
}
tempo = setTimeout("HeureCheck()", 1000)
}
</SCRIPT>
</head>
<body onLoad="HeureCheck()" onUnload="clearTimeout(tempo)">
 
 
<table border="0" cellspacing="0" cellpadding="0" width="50" height="50">
  <tr>
<td bgcolor="#000000" style="border: 1 solid #000000 " >
<table summary="" border="0" width="100%" height="100%">
<tr>
<!--  couleur fond et texte -->
<td  background="#000000"><CENTER>
<font color="#FFFFFF">
<!--  fin couleur fond et texte -->
<FONT SIZE=2 FACE="comic sans ms black"><B><SCRIPT LANGUAGE="JavaScript"> document.write(messageDate); </SCRIPT>
              </B></FONT>  
              <!-- image ici  -->
              <a target="_blank" title="Cartoons spirit" href="http://www.cartoons-spirit.fr/">  
              <img border="0" src="http://cartoons.spirit.free.fr/Monsite/Horloge/HORLOGE1.jpg" width="135" height="170"></a>
              <!-- fin image ici -->
              </a>  
              <ilayer id="dynamic1" width=100% height=15><layer id="dynamic2" width=100% height=15><div id="dynamic3"></div></layer></ilayer>
        </font></CENTER>
  </td>
 </tr>
</table>
 </tr>
</table>
</body>
</html>

mood
Publicité
Posté le 26-01-2017 à 11:07:59  profilanswer
 

n°2295248
rat de com​bat
attention rongeur méchant!
Posté le 26-01-2017 à 15:17:08  profilanswer
 

Le code entre balises http://forum-images.hardware.fr/icones/message/c.gif.
Il manque des point-virgules, regarde les messages d'erreur du navigateur. Et je pense que if (sec < 10) sec0 = "0"; (+ d'autres) est censé être if (sec < 10) sec0 = "0"+sec0;

n°2295272
hyogas
Posté le 27-01-2017 à 09:52:52  profilanswer
 

Je te remercie pour ta réponse mais je ne connais rien en informatique pourrais tu m'expliquer.
Merci d'avance de ton aide

n°2295311
hyogas
Posté le 29-01-2017 à 10:11:42  profilanswer
 

Je vous remercie tous pour votre aide. L'un d'entre vous m'a très gentiment mis à jour le code comme vous pouvez le voir ci dessous et il fonctionne très bien.  Merci encore de votre aide.
 

Code :
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  4. <title>Horloge</title>
  5. <SCRIPT type="text/javascript">
  6. var tempo;
  7. function get_date(){
  8.   navok = navigator.appVersion.substring(0,1) > 3 ? true : false ;
  9.   today = new Date;
  10.   numero = today.getDate();
  11.   numero = numero < 10 ? "0"+numero : numero;
  12.   annee = navok ? today.getFullYear() : today.getYear();
  13.   mois = today.getMonth() + 1 < 10 ? "0" + (today.getMonth() + 1) :(today.getMonth() + 1) ;
  14.   messageDate = numero + "/" + mois + "/" + annee;
  15.   return messageDate;
  16. }
  17. function HeureCheck() {
  18.   krucial = new Date;
  19.   heure = krucial.getHours();
  20.   min = krucial.getMinutes();
  21.   sec = krucial.getSeconds();
  22.   jour = krucial.getDate();
  23.   mois = krucial.getMonth()+1;
  24.   annee = krucial.getFullYear();
  25.   sec0 = sec < 10 ? "0" : "";
  26.   min0 = min < 10 ? "0" : "";
  27.   heure0 = heure < 10 ? "0" : "";
  28.   which = heure0 + heure + ":" + min0 + min + ":" + sec0 + sec;
  29.   document.getElementById('dynamic3').innerHTML='<FONT SIZE=2 FACE=" comic sans ms black "><B>'+which+'</B></FONT>';
  30.   tempo = setTimeout("HeureCheck()", 1000);
  31. }
  32. </SCRIPT>
  33. </head>
  34. <body onLoad="HeureCheck()" onUnload="clearTimeout(tempo)">
  35. <table border="0" cellspacing="0" cellpadding="0" width="50" height="50">
  36.   <tr>
  37. <td bgcolor="#000000" style="border: 1 solid #000000 " >
  38. <table summary="" border="0" width="100%" height="100%">
  39. <tr>
  40. <!--  couleur fond et texte -->
  41. <td  background="#000000"><CENTER>
  42. <font color="#FFFFFF">
  43. <!--  fin couleur fond et texte -->
  44. <FONT SIZE=2 FACE="comic sans ms black"><B><SCRIPT LANGUAGE="JavaScript"> document.write(get_date()); </SCRIPT>
  45.               </B></FONT>
  46. <!-- image ici  -->
  47.               <a title="Cartoons spirit" href="http://www.cartoons-spirit.fr/" rel="nofollow noopener noreferrer" target="_blank"> 
  48.               <img border="0" src=""http://cartoons.spirit.free.fr/Monsite/Horloge/HORLOGE1.jpg" width="135" height="170"></a>
  49.               <!-- fin image ici -->
  50.               </a> 
  51.               <ilayer id="dynamic1" width=100% height=15><layer id="dynamic2" width=100% height=15><div id="dynamic3"></div></layer></ilayer>
  52.         </font></CENTER>
  53.   </td>
  54. </tr>
  55. </table>
  56. </tr>
  57. </table>
  58. </body>
  59. </html>


 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  HTML/CSS

  Probleme d'afficheage de mon horloge

 

Sujets relatifs
problème sur fichier launch.batformulaire sans réel problème mais qui ne marche pas !?
code php pour formulaire qui me pose problèmeProblème META REFRESH tourne en boucle
Problème de listeprobleme d'affichage vba
Problème basique de page htmlProblème de requête sql
[C][pthreads] Probleme deconecton serveur client avec socketprobleme affichage
Plus de sujets relatifs à : Probleme d'afficheage de mon horloge


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR