begin process at 2012 05 29 07:44:47
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Javascript / DHTML / Ajax

 > 

Javascript et ActiveX

 > 

Autre

 > 

Conflit balises DIV


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

Conflit balises DIV

vendredi 6 octobre 2006 à 15:24:50 | Conflit balises DIV

finelarme


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 :

- [ Lien ]

- [ Lien ]

 

1) FADER.JS SUR TEXTE (ou téléchargable ici : [ Lien ])

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

appVer = navigator.appVersion;
IEmac = (IE4 && appVer.indexOf("Mac") != -1);
IE4mac = (IEmac && appVer.indexOf("MSIE 4") != -1);
IE40mac = (IE4mac && appVer.indexOf("4.0;") != -1);
IE45mac = (IE4mac && appVer.indexOf("4.5;") != -1);
NSpre401 = (NS4 && (parseFloat(appVer) <= 4.01));
NSpre403 = (NS4 && (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 && 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<arTXT.length;i++){
   arNews[arNews.length] = arTXT[i];
   arNews[arNews.length] = arURL[i];
  }
 }

    if (NS4) {
        if (!document.elFader) return;
  with(document.classes.newslink.A) {
  textDecoration = FDRlnkDec;
   color = FDRlnkCol;
   fontWeight = FDRfntWgh;
   fontSize = FDRfntSiz;
   fontStyle = FDRfntSty;
   fontFamily = FDRfntFam;
   lineHeight = FDRlinHgt;
   textAlign = FDRtxtAln;
  }
  with(document.classes.nolink.P) {
   color = FDRfntCol;
   fontWeight = FDRfntWgh;
   fontSize = FDRfntSiz;
   fontStyle = FDRfntSty;
   fontFamily = FDRfntFam;
   lineHeight = FDRlinHgt;
   textAlign = FDRtxtAln;
  }
        elFader = document.elFader;
  with (elFader) {
   document.write(" ");
   document.close();
   bgColor = FDRborCol;
   clip.width = FDRboxWid;
   clip.height = FDRboxHgt;
  }

  contWidth = FDRboxWid - (FDRborWid*2);
  contHeight = FDRboxHgt - (FDRborWid*2);
  elCont = new Layer(contWidth,elFader);
  with (elCont) {
   top = FDRborWid;
   left = FDRborWid;
   clip.width = contWidth;
   clip.height = contHeight;
   bgColor = FDRbackCol;
   visibility = "inherit";
  }

  newsWidth = contWidth - (FDRboxPad*2);
  newsHeight = contHeight - (FDRboxPad*2);
        elNews = new Layer(newsWidth,elCont);
  with (elNews) {
   top = FDRboxPad;
   left = FDRboxPad;
   clip.width = newsWidth ;
   clip.height = newsHeight;
  }

  if (!FDRjustFlip) {
   elGif = new Layer(contWidth,elCont);
         imStr = "<IMG SRC='" + FDRgifSrc +"' WIDTH="+ Math.max(FDRfadeImg.width,(FDRboxWid - (FDRborWid*2)));
   imStr += (NSpre403) ? " onError='window.FDRjustFlip = true'>" : ">";
         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 && !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 && loopCount>0) return;

    if (FDRfinite && 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 += "<P><A CLASS=newslink "
     + "HREF='" + prefix + linkStr + "'>"
              + dispStr + "</A></P>"
  }
  else {
   tempStr += ((NS4) ? "<P CLASS=nolink>" : "<P>") +dispStr+"</P>";

  }
        if(IE40mac) tempStr +="<BR>";
  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 && isLink) ? (prefix + linkStr) : "";

    if (NS4 && !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 -->[/code]

2) Et voici la page avec commentaire

[code]<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='<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()", 0)
}
</SCRIPT>
<!-- FIN SCRIPT : HORLOGE MILLISECONDE -->
</head>

<body onLoad="HeureCheck()" onUnload="clearTimeout(tempo)">
<!-- 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>
   <div id="elFader"></div>
   <!-- FIN SCRIPT FADER -->

    <div id="dynamic3"></div> <!-- CI-CONTRE : LE DIV HORLOGE MILLISECONDE QUI POSE PROBLEME ? -->
</body>
</html>
[/code]

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

Merci d'avance pour vos conseils.

_

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

mardi 10 octobre 2006 à 00:12:27 | Re : Conflit balises DIV

PetoleTeam

Membre Club


 
 
Bonjour...
Réponse à la louche sans déortiquer le code...
plusieurs onload qui peuvent entrer en conflit.

window.onload = FDRcountLoads;
<body onLoad="HeureCheck()" onUnload="clearTimeout(tempo)">

sous toutes reserves...


;0)


Cette discussion est classée dans : function, document, window, elfader, fdrjustflip


Répondre à ce message

Sujets en rapport avec ce message

Retour variable palette graphique [ par neooh56 ] Bonjour J'ai recupéré un script de pallette graphique je clic sur un bouton ca ouvre la palette et quand je clic sur une couleur ca la ferme et renvoi tribune [ par dOsSpr0uTosS ] Salut à tous, Je debute en java et je voudrais faire une tribune pour mon site donc je code ca mais rien ne se passe : function f Etirer un background [ par blat ] Bonjour, Je cherche à étirer un background d'une page afin qu'il remplisse toute la page et ce sans répétition. J'ai vu que cette opération est impo Cohabitation entre 2 codes impossible (compte à rebours+neige) [ par Aggshkn ] Bonjour,Je souhaite mettre dans une même page deux codes javascipt : un compte à rebours jusqu' au début de l' année 2006 (http://www.editeurjavascrip BOUCLE FOR [ par tonytruand ] BONSOIR,Je me prends la tête avec une boucle for imbriquée que je n'arrive pas à faire, un ptit coup de main svp.Bon là je peux créer un twisty en cli Probleme de différence de taille entre IE et Mozilla (etc) [ par chandler_vodkamartini ] Voilou, j'explique la situation, j'ai un scroll javascript qui agit sur une suite d'image et de texte placée dans un container qui a une certaine tail Ptite question sur une function js [ par destiny ] Bonjour tlm :)Voila j'ai fais une ptite function js qui me modifie la VALUE de mon input suivant la valuer d'un checkbox!function MajTexteValider() {  Print et load [ par zrelli ] j'ai besoin d'imprimer une fentre juste à l'evenemt load, j'ai rencontrer des pbs.voila mon code !var printwindow=window.open("_blank","print","");pri rendre image cliquable DHTML dans script fournit [ par bernie69 ] Bonjour à tous, Pour une de mes pages d'un site en php, j'ai intégré un script dhtml pris ici : http://www.dhteumeuleu.com/  (cliquer sur "les scripts Aide bienvenue... Pb avec setTimeout qui n'exécute qu'1 seule fois... [ par DaNifty ] Bonjour, J'ai un petit problème avec le code souce ci-dessous. Le pb est que la fonction setTimeout() execute correctement le code, mais uniquement 1


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,468 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales