Aide pour un javascript svp et un grand merci

guy -  
 Utilisateur anonyme -
Tout d abord bonjour a tous et merci d être là !!!
Voila j ai un code java script qui represente une horloge qui fonctionne très bien en étant seul sur une page web. ok !!
Elle affiche la date en haut, une image perso au millieu, et l heure en bas. ok
Mais le probleme c est que çi je veux aficher plusieur fois se meme code sur la meme page web !! elle n afiche plus que la date et l image !!! l heure disparait !!!!! rrrrrrrrrr
Moi je ne suis pas capable de trouver l erreur !!!!
Quelqu un pourait t il m aider sur se probleme ?? svp
Voici le code:
******************************************************
div align="center"><SCRIPT language=JavaScript>
<!--
function SymError()
{
return true;
}
window.onerror = SymError;
var SymRealWinOpen = window.open;
function SymWinOpen(url, name, attributes)
{
return (new Object());
}
window.open = SymWinOpen;
//-->
</SCRIPT>
<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=1 FACE="Verdana, Arial"><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 vLink=#d9cce7 aLink=#d9cce7 link=#d9cce7
onload="var SymTmpWinOpen = window.open; window.open = SymWinOpen; HeureCheck(); window.open = SymTmpWinOpen;"
onunload="var SymTmpWinOpen = window.open; window.open = SymWinOpen; clearTimeout(tempo); window.open = SymTmpWinOpen;" text="#ffffff">
<TABLE height=108 cellSpacing=3 cellPadding=3 width=110 border=0<!-- espace cadre bord 1 -->
<TBODY>
<TR>
<TD bgColor=#9756dc height=110>
<TABLE height="100%" width="100%" summary="" border=3>
<TBODY>
<TR><!-- couleur fond et text -->
<TD bgColor=#ffffff height=118 <!-- style="color: #ffffff">
<CENTER><font color="9756dc"><!-- fin couleur fond et text --><FONT
face="Verdana, Arial" size=1><B>
<SCRIPT language=JavaScript> document.write(messageDate); </SCRIPT>
</B></FONT><A href="
" target=_blank><!-- images ici --><IMG height=120
src="http://membres.lycos.fr/minatores/toile__15_0.jpg
" width=100 alt=""<!-- fin images ici --></A><ILAYER id=dynamic1 width="100%" height="15"><LAYER
id=dynamic2 width="100%" height="15">
</font><FONT color="#9756dc">
<DIV
id=dynamic3></DIV></LAYER></ILAYER></FONT></CENTER></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<SCRIPT
language=JavaScript>
<!--
window.open = SymRealWinOpen;
//-->
</SCRIPT></div>
******************************************************
Je remercie d avance celui ou celle qui voudrait bien m aider.
Guy
A voir également:

2 réponses

ranet007 Messages postés 2 Statut Membre
 
salut mon amis voila une aidé
utiliser plusieur image peut etre ça marchera
0
guy
 
merci c est gentil !!! mais là je ne comprend pas trop !!!
Ceci est fait pour faire plusieur hoeloge avec oui !!!! des images differentes, mais c est là que l heure disparait.
Merci quand-même.
Guy
0
Utilisateur anonyme
 
Dans la fonction HeureCheck(),

remplace:
if (document.all){ 
dynamic3.innerHTML='<center>00:00:00</center>' 
dynamic3.innerHTML='<FONT SIZE=1 FACE="Verdana, Arial"><B>'+which+'</B></FONT>'; 
} 
else if (document.layers){ 
document.dynamic1.document.dynamic2.document.write(''+which+'') 
document.dynamic1.document.dynamic2.document.close() 
} 


par:
  dyns = document.getElementsByName("dynamic1");
  for(i=0 ; i<dyns.length ; i++){
    dyns[i].innerHTML='<span style="font-size: x-small; font-family: Verdana, Arial; font-weight: bold;">'+which+'</span>';
  } 



Je me suis permis d'épuré ton code (balises ouverte et non fermées ou l'inverse, accolades manquantes, ...) et de remonter les proriétés des balises dans une CSS en ligne (plus aisé pour la maintenance ;-) ).

Voici le code modifié:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
  <style>
    body{
	  color: #000000;
	}
	a:link, a:visited, a:active {
	  text-decoration: none
	}
	a:hover{
 	  color: #ffffff;
	}	
    table{
	   height: 108px;
	   cellSpacing: 3px;
	   cellPadding: 3px;
	   width: 110px;
	   border-style: none;
	   border-width: 0px;
	}
	div{
	  width: 100%;
	  height: 15px;
	  color: blue;
	  text-align: center;
	}
  </style>
  
  <SCRIPT language="javascript" type="text/javascript"> 
    function SymError(){ 
      return true; 
    } 
    window.onerror = SymError; 
    var SymRealWinOpen = window.open; 
    function SymWinOpen(url, name, attributes){ 
      return (new Object()); 
     } 
    window.open = SymWinOpen; 
  </SCRIPT>
  
   
  <SCRIPT language="javascript" type="text/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(); 

	  sec0 = (sec<10?"0":"");
	  min0 = (min<10?"0":"");
	  heure0 = (heure<10?"0":"");	  

	  DinaHeure = heure0 + heure + ":" + min0 + min + ":" + sec0 + sec; 
	  which = DinaHeure
	   
  	 dyns = document.getElementsByName("dynamic1");
	 for(i=0 ; i<dyns.length ; i++){
       dyns[i].innerHTML='<span style="font-size: x-small; font-family: Verdana, Arial; font-weight: bold;">'+which+'</span>';
	 } 

	  tempo = setTimeout("HeureCheck()", 1000);
	} 
  </SCRIPT> 
</HEAD> 
 <BODY onload="var SymTmpWinOpen = window.open; window.open = SymWinOpen; HeureCheck(); window.open = SymTmpWinOpen;" 
  onunload="var SymTmpWinOpen = window.open; window.open = SymWinOpen; clearTimeout(tempo); window.open = SymTmpWinOpen;">
 <div>
 <center>   
  <TABLE>
    <TBODY> 
      <TR> 
	    <TD style="background-color: #9756dc; height: 110px;"> 
		  <TABLE style="height: 100%; width: 100%; border-style: solid; border-width: 3px"> 
		    <TBODY> 
			  <TR>
			    <TD style="background-color: #ffffff; height: 118px; font-family: Verdana, Arial; font-size: x-small; font-weight: bold;">
				  <A href="" target="_blank" id="a_1">
				  	 <IMG id="i_1" height="120px" src="http://membres.lycos.fr/minatores/toile__15_0.jpg" width="100px" alt="">
				  </A>
				  <div>
				    <div id=dynamic1>
				    </div>						   
				  </div>
				</TD>
			  </TR>
			</TBODY>
		  </TABLE>
		</TD>
      </TR>
	</TBODY>
  </TABLE>
  <SCRIPT language=JavaScript>
    document.write(messageDate); 
  	window.open = SymRealWinOpen;
  </SCRIPT>
 </center>

 <center>   
  <TABLE>
    <TBODY> 
      <TR> 
	    <TD style="background-color: #9756dc; height: 110px;"> 
		  <TABLE style="height: 100%; width: 100%; border-style: solid; border-width: 3px"> 
		    <TBODY> 
			  <TR>
			    <TD style="background-color: #ffffff; height: 118px; font-family: Verdana, Arial; font-size: x-small; font-weight: bold;">
				  <A href="" target="_blank" id="a_1">
				  	 <IMG id="i_1" height="120px" src="http://membres.lycos.fr/minatores/toile__15_0.jpg" width="100px" alt="">
				  </A>
				  <div>
				    <div id=dynamic1>
				    </div>						   
				  </div>
				</TD>
			  </TR>
			</TBODY>
		  </TABLE>
		</TD>
      </TR>
	</TBODY>
  </TABLE>
  <SCRIPT language=JavaScript>
    document.write(messageDate); 
  	window.open = SymRealWinOpen;
  </SCRIPT>
 </center> 
 
</div> 

</body>
</html>



;-)
HackTrack
0
guy
 
Bonsoir Hacktrack

Excuse moi pour d avoir tardé pour te répondre, j était absent !!
merci pour le temps que tu as passé sur se code !!!
Mais j ai essayé, et maintenant je ne vois plus l heure s afficher du tout !!! ????
Qu en penses tu ?
Encore merci
Amitiés
Guy
0
Utilisateur anonyme > guy
 
Salut Guy!

Es-tu certain que tu n'emploies pas la même couleur pour afficher l'heure et comme couleur de fond?

J'ai dû changer la couleur d'affichage de l'heure car elle était invisible chez moi!

Pour vérifier cela, ouvre cette page et sélectionne toute la page (Edit - Select All dans Internet Explorer). Si l'heure apparaît, c'est que le problème est bien celui dont je te fais part ci-dessus.

;-)
HackTrack
0