IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

onload et onmouseover non fonctionnel sous firefox


Sujet :

JavaScript

  1. #1
    Membre confirmé
    Inscrit en
    Mars 2009
    Messages
    201
    Détails du profil
    Informations forums :
    Inscription : Mars 2009
    Messages : 201
    Par défaut onload et onmouseover non fonctionnel sous firefox
    bonjour,
    comme l'a dit le titre j'ai une fonction js et je veux quelle démarre lorsque la page se charge, sous ff elle ne fonctionne pas mais sous ie fonctionne trés bien
    meme chose pour onmouseover lorsque je l'essaie
    je me suis bloqué
    merci

  2. #2
    Membre Expert Avatar de franculo_caoulene
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    2 880
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 2 880
    Par défaut
    Salut,

    Nous ne sommes pas devins, aide-nous à t'aider. Poste un code (X)HTML/CSS/Javascript simplifié au maximum n'illustrant que ton problème.
    Exemple :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <title>modèle de code pour bien poster</title>
      <meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
      <style type="text/css">
      /* code css */
      </style>
    </head>
    <body>
      <!-- code xhtml -->
      <script type="text/javascript">
      <!--
        // code javascript
      //-->
      </script>
    </body>
    </html>

  3. #3
    Membre confirmé
    Inscrit en
    Mars 2009
    Messages
    201
    Détails du profil
    Informations forums :
    Inscription : Mars 2009
    Messages : 201
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    <html>
    <head>
    <title>News</title>
    <style type="text/css" >  
    <!--
    .top{
    background-image:url(admin/image/design/top.gif);
    background-repeat:repeat-x;
    height:100%;
    width:100%;
    }
    .bottom{
    background-image:url(admin/image/design/bottom.gif);
    background-repeat:repeat-x;
    background-position:bottom;
    height:100%;
    width:100%;
    }
    .left{
    background-image:url(admin/image/design/left.gif);
    background-repeat:repeat-y;
    height:100%;
    width:100%;
    }
    .right{
    background-image:url(admin/image/design/right.gif);
    background-repeat:repeat-y;
    background-position:right;
    height:100%;
    width:100%;
    }
    .topLeft{
    background-image:url(admin/image/design/topLeft.gif);
    background-repeat:no-repeat;
    height:100%;
    width:100%;
    }
    .topRight{
    background-image:url(admin/image/design/topRight.gif);
    background-repeat:no-repeat;
    background-position:top right;
    height:100%;
    width:100%;
    }
    .bottomLeft{
    background-image:url(admin/image/design/bottomLeft.gif);
    background-repeat:no-repeat;
    background-position:bottom left;
    height:100%;
    width:100%;
    }
    .bottomRight{
    background-image:url(admin/image/design/bottomRight.gif);
    background-repeat:no-repeat;
    background-position:bottom right;
    height:100%;
    width:100%;
    }
    .marque{
     
    	width:206px;
    	position:relative;
        margin-top:5px;
     
    }
    .cadre_marq{
    width:206px;
    margin:0px;
    }
    div#conteneur div.posrelative
    {
    width:205px;
    POSITION: relative;
    text-align:center;
    }
    #conteneur
    {
    	OVERFLOW: hidden;
    	CLIP: rect(0px 250px 200px 0px);
    	WIDTH: 193px;
    	height: 155px;
    	position:absolute;
    	left: 6px;
    	top: 7px;
    }
    //-->
    </style>
    <script language="JavaScript" src="scroll.js"></script>
    <script language="JavaScript" type="text/javascript">
    <!--
    var MyBox = null;
     
    function Init()
    	{
    	MyBox = new Box('MyBox', 'conteneur', 1, 100, 2000, 10);
      MyBox.start();
      }
     
    //-->
    </script>
    </head>
    <body onLoad="Init();">
     
    <div class="marque">
    	  <div class="cadre_marq"
     
     
    ><div class="top"
    ><div class="bottom"
    ><div class="left"
    ><div class="right"
    ><div class="topLeft"
    ><div class="topRight"
    ><div class="bottomLeft"
    ><div class="bottomRight"
     
    >
    <table border=0 CELLSPACING=0 CELLPADDING=0>
     
    <tr>
    <td width=205 height=170><spacer type="block" width=205 height=170></td>
    </tr>
    </table>
     
    <DIV ID="conteneur" onMouseOver="MyBox.stop();" onMouseOut="MyBox.start();">
    <DIV ID="info1" class="posrelative">
    <A HREF="http://www.pneu-amine.com.tn">
    <IMG class="posrelative" SRC="marque/amine.png" title="www.pneu-amine.com.tn" border=0></A><hr /></DIV>
    <DIV ID="info1" class="posrelative">
    <A HREF="http://www.barum-online.com">
    <IMG class="posrelative" SRC="marque/BARUM.jpg" title="www.barum-online.com" border=0></A><hr /></DIV>
    <DIV ID="info1" class="posrelative">
    <A HREF="http://www.bkt-tires.com">
    <IMG class="posrelative" SRC="marque/bkt.jpg" title="www.bkt-tires.com" border=0></A><hr /></DIV>
    <DIV ID="info1" class="posrelative">
    <A HREF="http://www.marangoni.com">
    <IMG class="posrelative" SRC="marque/Marangoni.jpg" title="www.marangoni.com" border=0></A><hr /></DIV>
    <DIV ID="info1" class="posrelative">
    <A HREF="http://www.makwheels.it">
    <IMG class="posrelative" SRC="marque/logo.jpg" title="www.makwheels.it" border=0></A><hr /></DIV>
    <DIV ID="info1" class="posrelative">
    <A HREF="http://www.uniroyal-online.com">
    <IMG class="posrelative" SRC="marque/uniroyal.png" title="www.uniroyal-online.com" border=0></A><hr /></DIV>
    <DIV ID="info1" class="posrelative">
    <A HREF="http://www.maxxis.com">
    <IMG class="posrelative" SRC="marque/maxiis.png" title="www.maxxis.com" border=0></A><hr /></DIV>
    </DIV>
     
     
    </div></div></div></div></div></div></div></div
     
     
    ></div>
    </div>
        </div>
     
    </body>
    </html>

  4. #4
    Membre Expert Avatar de franculo_caoulene
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    2 880
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 2 880
    Par défaut
    Le problème vient de MyBox, cette fonction affiche bien une alerte au chargement de la page :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    function Init()
    	{
      alert("blah");
    	MyBox = new Box('MyBox', 'conteneur', 1, 100, 2000, 10);
      MyBox.start();
      }

  5. #5
    Membre confirmé
    Inscrit en
    Mars 2009
    Messages
    201
    Détails du profil
    Informations forums :
    Inscription : Mars 2009
    Messages : 201
    Par défaut
    oui exactement ca affiche,
    mais ou est le probleme de mybox

  6. #6
    Membre Expert Avatar de franculo_caoulene
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    2 880
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 2 880
    Par défaut
    Citation Envoyé par franculo_caoulene Voir le message
    Nous ne sommes pas devins
    Ce doit être une mauvaise utilisation du composant. Si tu l'as choisi c'est qu'il fonctionne. S'il ne fonctionne pas dans ton code, c'est que tu l'utilises mal. Je ne peux en dire plus, je ne connais pas ce composant.

  7. #7
    Membre confirmé
    Inscrit en
    Mars 2009
    Messages
    201
    Détails du profil
    Informations forums :
    Inscription : Mars 2009
    Messages : 201
    Par défaut
    mais le prob c'est qu'il ne marche pas sous ff et fonctionne sous ie
    voici le code scroll.js
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    <!--
    /* Copyright 2001 : Atout Développement */
    /* Auteur : Yvan Vanwynsberghe		      */
    var ns4 = (document.layers)? true:false;   			//NS 4 
    var ie4 = (document.all)? true:false;   				//IE 4 
    var dom = (document.getElementById)? true:false;   //DOM
     
    function GetNS4Object(MyID,MyDocument)
    	{
    	var MyObject= eval('MyDocument.'+MyID);
      if (!(MyObject))
      	for(var i=0;i<MyDocument.layers.length;i++)
    			{
    			MyObject = GetNS4Object(MyID,MyDocument.layers[i].document);
    			if (MyObject) break;
    			}
      return MyObject;
      }
     
     
    function GetObject(MyID)
    	{
      if (dom) return document.getElementById(MyID);
      if (ie4) return document.all[MyID];
      if (ns4) return GetNS4Object(MyID,window.document);
      return 0;
    	} 
     
    function GetCSS(MyObject)
    	{
      if (dom || ie4) return MyObject.style;
      else if (ns4) return MyObject;
      else return 0;
    	}
     
    function GetHeight(MyObject)
    	{ 
      if (dom || ie4) return MyObject.offsetHeight;
      else if (ns4) return MyObject.clip.height;
      else return 0;
    	}
     
    function GetWidth(MyObject)
    	{ 
      if (dom || ie4) return MyObject.offsetWidth;
      else if (ns4) return MyObject.clip.width;
      else return 0;
    	}
     
    function GetTop(MyObject)
    	{ 
      if (dom || ie4) 
      	return (MyObject.offsetTop);
      if (ns4) return MyObject.y;
      	return 0;
    	}
     
    function GetLeft(MyObject)
    	{ 
      if (dom || ie4) return MyObject.offsetLeft;
      if (ns4) return MyObject.x;
      return 0;
    	}
     
    function MoveObject(myX,myY)
    	{
      this.X = myX;
      this.Y = myY;
      this.CSS.left=this.X;
      this.CSS.top=this.Y;
      }
     
    function MoveObjectUp(mystep)
    	{
      this.Y -= mystep;
      this.CSS.top=this.Y;
      }
     
    function MoveObjectDown(mystep)
    	{
      this.Y += mystep;
      this.CSS.top=this.Y;
      }
     
    function CreateObject(DivId,MyObject)
    		{
        if (MyObject)
        	this.Object = MyObject;
        else
        	this.Object = GetObject(DivId);
     
        if (this.Object)
        	{
          this.CSS = GetCSS(this.Object);
          this.Height = GetHeight(this.Object);
          this.Width = GetWidth(this.Object);
          this.X = GetTop(this.Object);
          this.Y = GetLeft(this.Object);
          this.Move = MoveObject;
          this.Up = MoveObjectUp;
          this.Down = MoveObjectDown;
          }
        return this;
        }
     
    function DelTextNode(MyObject)
    	{
      var node = MyObject.firstChild;
      var next;
     
      while (node)
      	{
        next = node.nextSibling;
        if (node.nodeType == 3)
          MyObject.removeChild(node);
        node = next;
      	}
      }
     
    function CreateChildren(MyObject,HoriSpacer,VertSpacer)
    	{
      var i=0;
      var MyChildren = new Array();
      if (dom)
      	{
        DelTextNode(MyObject);
        for (i=0;i<MyObject.childNodes.length;i++)
        	{
        	MyChildren[i] = new CreateObject(0,MyObject.childNodes[i]);
          MyChildren[i].Move(i*HoriSpacer,i*VertSpacer);
          }
        return MyChildren;
        }
      if (ie4)
      	{
        for (i=0;i<MyObject.children.length;i++)
        	{
          MyChildren[i] = new CreateObject(0,MyObject.children(i));
          MyChildren[i].Move(i*HoriSpacer,i*VertSpacer);
          }
        return MyChildren;
        }
      if (ns4)
      	{
        for (i=0;i<MyObject.document.layers.length;i++)
        	{
          MyChildren[i] = new CreateObject(0,MyObject.layers[i]);
          MyChildren[i].Move(i*HoriSpacer,i*VertSpacer);
          }
        return MyChildren;   
        }
      }
     
    function ScrollUp()
    	{
      var MyInterval = this.Interval1;
      this.stop();
      if (this.Children[this.FirstChildren].Y<-this.threshold)
      	{
        MyInterval = this.Interval2;
     	  this.Children[this.FirstChildren].Down(this.TotalHeight);
        if (this.FirstChildren<this.Children.length-1)
        	{
        	this.FirstChildren++;
          this.threshold += this.Children[this.FirstChildren].Height;
          }
        else
        	{
        	this.FirstChildren = 0;
          this.threshold = this.Children[this.FirstChildren].Height+this.Spacer;
          }
        }
    	for (var i=0;i<this.Children.length;i++)
      	{
        this.Children[i].Up(this.Step);    
        }
      this.ProcessId = setTimeout(this.name + '.start()', MyInterval);
      }
     
     
    function ScrollStop()
    	{
      if (this.ProcessId)
        clearTimeout(this.ProcessId);
      this.ProcessId = null;
    	}
     
    function Box(BoxName, DivId, myStep, myTempo1, myTempo2, mySpacer)
    	{
      this.name     = BoxName;
      this.Step  = myStep ? myStep : 1;
      this.Interval1 = myTempo1 ? myTempo1 : 100;
      this.Interval2 = myTempo2 ? myTempo2 : 100;
      this.Spacer = mySpacer ? mySpacer : 0;
      this.ProcessId	= null;
      this.Container = new CreateObject(DivId);
      this.Children = new CreateChildren(this.Container.Object,0,mySpacer);
      this.FirstChildren = 0;
      this.LastChildren = this.Children.length-1;
      this.threshold = this.Children[0].Height+this.Spacer;
      var myHeight = 0;
      for (var i=0;i<this.Children.length;i++) 
      	{
        myHeight += (this.Children[i].Height + this.Spacer);
        }
      this.TotalHeight = myHeight;
      this.Container.visibility = 'visible';
    	}
     
    Box.prototype.start = ScrollUp;
    Box.prototype.stop = ScrollStop;
    //-->

  8. #8
    Membre éprouvé

    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    1 448
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2006
    Messages : 1 448
    Par défaut
    Citation Envoyé par hraiwen Voir le message
    oui exactement ca affiche,
    mais ou est le probleme de mybox
    C'est toi qui a écrit cette classe MyBox ?

    Si oui montre nous le code, sinon, fais un rapport de bug à ses développeurs.

  9. #9
    Expert confirmé
    Avatar de Auteur
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    7 660
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 7 660
    Par défaut
    bonjour,

    déjà dans la partie CSS :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    #conteneur
    {
    	OVERFLOW: hidden;
    	CLIP: rect(0px 250px 200px 0px);
    	WIDTH: 193px;
    écris en minuscules le nom des styles.
    Ensuite je me demande si le style clip existe

    Regarde également la console d'erreurs de FF (outils -> console d'erreur) et poste les messages s'il y en a.

  10. #10
    Invité de passage
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 1
    Par défaut
    Bonjour,
    J'utilise aussi ce script javascript.
    Il fonctionnait très bien jusqu'à ce que j'essaye de respecter les normes W3C:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    depuis, le script fonctionne avec IE, mais plus avec FF.

    Le pb ne vient pas du onload ni du onmouseover (le test avec alert() fonctionne), je penche plutot pour un pb de compatibilité dans le code.

    Ca fait un moment que je cherche et je n'ai pas encore trouvé.

Discussions similaires

  1. History.back() non fonctionnel sous Firefox
    Par Guillaume_Caldera dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 14/10/2009, 16h41
  2. Code non fonctionnel sous Firefox
    Par linar009 dans le forum Général JavaScript
    Réponses: 21
    Dernier message: 24/07/2006, 16h13
  3. Réponses: 3
    Dernier message: 10/05/2006, 10h54
  4. CSS non reconnues sous Firefox et Netscape
    Par rockingstone dans le forum Mise en page CSS
    Réponses: 11
    Dernier message: 07/04/2006, 21h20
  5. [CSS] Pb de css non compatible sous Firefox
    Par laurentdusseau dans le forum Mise en page CSS
    Réponses: 12
    Dernier message: 14/09/2005, 17h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo