Conflit balises DIV

cs_finelarme Messages postés 5 Date d'inscription mardi 8 avril 2003 Statut Membre Dernière intervention 12 juillet 2008 - 6 oct. 2006 à 15:24
PetoleTeam Messages postés 3426 Date d'inscription lundi 26 décembre 2005 Statut Membre Dernière intervention 14 janvier 2011 - 10 oct. 2006 à 00:12
Bonjour,


J'ai un problème pour "combiner" deux balises DIV. Il y'à deux actions dans ma page : un compte à rebours que j'ai paramêtré et un fader sur un texte. Seulement je ne peux qu'avoir l'un ou l'autre, mais pas les deux simultanément, les scripts rentrent en conflit apperement.


Voici les deux fonctions que j'aimerais faire appariatre dans ma page :


- http://mon.olive.au.preon.free.fr/site/exemple_horloge.htm


- http://mon.olive.au.preon.free.fr/site/exemple_fader.htm


 


1) FADER.JS SUR TEXTE (ou téléchargable ici : http://mon.olive.au.preon.free.fr/site/fader.js)


<!-- DEBUT DU SCRIPT -->
<!-- SCRIPT TROUVE SUR WEBJS -->
NS4 =  (document.layers);
IE4 = (document.all);


appVer = navigator.appVersion;
IEmac = (IE4 &amp;&amp; appVer.indexOf("Mac") != -1);
IE4mac = (IEmac &amp;&amp; appVer.indexOf("MSIE 4") != -1);
IE40mac = (IE4mac &amp;&amp; appVer.indexOf("4.0;") != -1);
IE45mac = (IE4mac &amp;&amp; appVer.indexOf("4.5;") != -1);
NSpre401 = (NS4 &amp;&amp; (parseFloat(appVer) <= 4.01));
NSpre403 = (NS4 &amp;&amp; (parseFloat(appVer) <= 4.03));


FDRjustFlip = (window.FDRjustFlip) ? FDRjustFlip : false;
FDRhdlineCount = (window.FDRhdlineCount) ? FDRhdlineCount : 1;


FDRfinite = (FDRmaxLoops > 0);
FDRisOver = false;
FDRloadCount = 0;




blendTimer = null;


if (!window.prefix) prefix = "";
window.onload = FDRcountLoads;


if (NS4) {
 if(FDRjustFlip || NSpre403) {
  totalLoads = 1;
  FDRfadeImg = new Object();
  FDRfadeImg.width = FDRboxWid - (FDRborWid*2);;
 }
 else {
  totalLoads = 2;
  FDRfadeImg = new Image();
  FDRfadeImg.onload = FDRcountLoads;
  FDRfadeImg.onerror = FDRcountLoads;
  FDRfadeImg.src = FDRgifSrc;
 }
}


function FDRcountLoads(e) {
 if (IE4) {
  setTimeout("FDRinit()",1);
 }
 else {  if(e.type "error") FDRjustFlip true; 
  FDRloadCount++;
  if (FDRloadCount==totalLoads) {
   origWidth = innerWidth;
   origHeight = innerHeight;
   window.onresize = function(){
    if (innerWidth==origWidth &amp;&amp; innerHeight==origHeight) return;
    location.reload();
   }
   FDRinit();
  }
 }
}


function FDRinit(){
 if(!window.arNews) {
  if(!window.arTXT || !window.arURL) return;
  if(arTXT.length != arURL.length) return;
  arNews = [];
  for (i=0;i";
         with (elGif) {
    document.write(imStr);
          document.close();
    moveAbove(elNews);
   }
 
   imgHeight = elGif.document.height;
   slideInc = (imgHeight/(FDRblendDur*1000/FDRgifInt));
   startTop = -(imgHeight - FDRboxHgt);
  }


  elFader.visibility =  "show";
    }
    else {
        if (!window.elFader) return;
  elFader.innerHTML ="";
  if(IE4mac) {
   document.body.insertAdjacentHTML("BeforeBegin","<STYLE></STYLE>");
  }
  else {
   if (!document.styleSheets.length) document.createStyleSheet();
  }
  with (document.styleSheets(document.styleSheets.length-1)) {
   addRule("A.newslink","text-decoration:"+FDRlnkDec+";color:"+ FDRlnkCol);
   addRule("A.newslink:hover","color:"+ FDRhovCol);
  }


  with (elFader.style) {
   errorOffset = (IE4mac) ? (FDRboxPad + FDRborWid) : 0;


   width = FDRboxWid - (errorOffset * 2);
   height = FDRboxHgt - (errorOffset * 2);
   if(IE4mac &amp;&amp; !IE45mac){
    pixelLeft = elFader.offsetLeft + errorOffset;
    pixelTop = elFader.offsetTop + errorOffset;
   }


   backgroundColor = FDRbackCol;
   overflow = "hidden";
   color = FDRfntCol;
   fontWeight = FDRfntWgh;
   fontSize = FDRfntSiz;
   fontStyle = FDRfntSty;
   fontFamily = FDRfntFam;
   lineHeight = FDRlinHgt;
   textAlign = FDRtxtAln;
   cursor = "default";
   visibility = "visible";
   borderWidth = FDRborWid;
   borderStyle = FDRborSty;
   borderColor = FDRborCol;
   padding  = FDRboxPad;


   if(!FDRjustFlip) filter = "blendTrans(duration=" + FDRblendDur + ")";
  }
  elFader.onselectstart = function(){return false};


  IEhasFilters = (elFader.filters.blendTrans) ? true : false;


    }


 if (!NSpre401) {
  elFader.onmouseover = function (){
   FDRisOver = true;
  }
  elFader.onmouseout = function(){
   FDRisOver = false;
   status = "";
  }
 }
 
 FDRstart(0);
}


function FDRstart(ind){
    newsCount = ind;
    if (FDRfinite) loopCount = 0;
    FDRdo();
    blendTimer = setInterval("FDRdo()",FDRblendInt*1000)
}


function FDRdo() {
 if(!blendTimer &amp;&amp; loopCount>0) return;


    if (FDRfinite &amp;&amp; loopCount==FDRmaxLoops) {
        FDRend();
  return;
    }
 FDRfade();
    if (newsCount == arNews.length) {
        newsCount = 0;
        if (FDRfinite) loopCount++;
    }
}


function FDRmakeStr(){
 tempStr = "";
 for (i=0;i<FDRhdlineCount;i++){
  if(newsCount>=arNews.length)break;
  dispStr = arNews[newsCount];
  linkStr = arNews[newsCount+1];
  isLink = linkStr.length;
  if (isLink) {
   tempStr += ""
              + dispStr + "

"
  }
  else {
   tempStr += ((NS4) ? "" : "") +dispStr+"

";


  }
        if(IE40mac) tempStr +="
";
  newsCount += 2;
 }
 return tempStr;
}


function FDRfade(){
 newsStr = FDRmakeStr();
    if (NS4) {
  if (!FDRjustFlip) {
   elGif.top = startTop;
   elGif.visibility = "inherit";
  }


  elNews.visibility = "hide";
        with (elNews.document) {
            write(newsStr);
            close();
        }
  elNews.visibility = "inherit";
    }
    else {
        if(IEhasFilters)elFader.filters.blendTrans.Apply();
        elFader.innerHTML = newsStr;
        if(IEhasFilters)elFader.filters.blendTrans.Play();
    }


 if(FDRhdlineCount==1) window.status = (FDRisOver &amp;&amp; isLink) ? (prefix + linkStr) : "";


    if (NS4 &amp;&amp; !FDRjustFlip) FDRslide();
}


function FDRslide(){
    elGif.top += slideInc;    if (elGif.top >0) {elGif.visibility "hide";return}
    setTimeout("FDRslide()",FDRgifInt);
}


function FDRdblClickNS(){
 elFader.releaseEvents(Event.DBLCLICK);
 FDRstart(startIndex);
 return false;
}


function FDRend(){
 clearInterval(blendTimer);


 blendTimer = null;


 if (FDRendWithFirst) {
  newsCount = 0;
  FDRfade();
 }
 if (FDRreplayOnClick) {


  startIndex = FDRendWithFirst ? (FDRhdlineCount * 2) : 0;
  if (IE4) {
   elFader.title = "Double click to replay";
   elFader.ondblclick = function(){
    this.ondblclick = null;
    this.title = "";
    FDRstart(startIndex);
   }
  }
  else {
   elFader.captureEvents(Event.DBLCLICK);
   elFader.ondblclick = FDRdblClickNS;


  }
    }
}
<!-- FIN DU SCRIPT -->



2) Et voici la page avec commentaire


<html>
<head>
<!-- SCRIPT CI-DESSOUS : HORLOGE MILLISECONDE -->
<SCRIPT LANGUAGE="JavaScript">
function HeureCheck()
{
krucial = new Date;
heure = krucial.getHours();
min = krucial.getMinutes();
sec = krucial.getSeconds();
mil = krucial.getMilliseconds();
jour = krucial.getDate();
mois = krucial.getMonth()+1;
annee = krucial.getFullYear();
if (mil < 10)
mil0 = "00";
if (mil < 100)
mil0 = "0";
else
mil0 = "";
if (sec < 10)
sec0 = "0";
else
sec0 = "";
if (min < 10)
min0 = "0";
else
min0 = "";
if (heure < 10)
heure0 = "0";
else
heure0 = "";
DinaHeure = sec0 + sec + ":" + mil0 + mil;
which = DinaHeure
if (document.all){
dynamic3.innerHTML='<center>00:00:00</center>'
dynamic3.innerHTML=' '+which+' ';
}
else if (document.layers){
document.dynamic1.document.dynamic2.document.write(''+which+'')
document.dynamic1.document.dynamic2.document.close()
}
tempo  = setTimeout("HeureCheck()", 0)
}
</SCRIPT>
<!-- FIN SCRIPT : HORLOGE MILLISECONDE -->
</head>



<!-- SCRIPT CI-DESSOUS : FADER -->
 <script language="JavaScript1.2" type="text/javascript">
<!--
NS4 = (document.layers);
IE4 = (document.all);
FDRboxWid = 800;
FDRboxHgt = 17;
FDRborWid = 0;
FDRborCol = "#D0D7DD";
FDRborSty = "solid";
FDRbackCol = "";
FDRboxPad = 0;


FDRtxtAln = "center";
FDRlinHgt = "10pt";
FDRfntFam = "Verdana";
FDRfntCol = "#000000";
FDRfntSiz = "10pt";
FDRfntWgh = "";
FDRfntSty = "normal";
FDRlnkCol = "#8B9294";
FDRlnkDec = "underline";
FDRhovCol = "#4A647B";


FDRgifInt = 60;


FDRblendInt = "5";
FDRblendDur = 1;
FDRmaxLoops = 100;


FDRendWithFirst = true;
FDRreplayOnClick = true;


FDRjustFlip = false;
FDRhdlineCount = 0;
//-->
    </script>
      <script language="JavaScript1.2" type="text/javascript">
arNews = ["TEXTE FADER 1","","TEXTE FADER 2","","TEXTE FADER 3","",]
      </script>   
      <script language="JavaScript1.2" src="fader.js" type="text/javascript"></script> 
   

   <!-- FIN SCRIPT FADER -->


    

 <!-- CI-CONTRE : LE DIV HORLOGE MILLISECONDE QUI POSE PROBLEME ? -->

</html>



Pensez-vous qu'il est possible d'actionner la fonction fader et horloge sur la même page ?


Merci d'avance pour vos conseils.


_


[Message édité par zenxd le 06-10-2006 à 15:01]

1 réponse

PetoleTeam Messages postés 3426 Date d'inscription lundi 26 décembre 2005 Statut Membre Dernière intervention 14 janvier 2011 17
10 oct. 2006 à 00:12
 
 
Bonjour...
Réponse à la louche sans déortiquer le code...
plusieurs onload qui peuvent entrer en conflit.




window.onload = FDRcountLoads;



sous toutes reserves...















;0)
0
Rejoignez-nous