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 :

Problème de style avec firefox


Sujet :

JavaScript

  1. #1
    Membre régulier Avatar de 12_darte_12
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Février 2005
    Messages
    212
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Haut Rhin (Alsace)

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : Transports

    Informations forums :
    Inscription : Février 2005
    Messages : 212
    Points : 107
    Points
    107
    Par défaut Problème de style avec firefox
    Bonjour,

    Voial mon code :

    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
    function position(e,nom_div)
    	{
    		// coordonnées du curseur
     
    				var PosSourisHoriz = 0
    				var PosSourisVerti = 0
     
    			x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
    			y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
     
    				PosSourisHoriz = x;
    				PosSourisVerti = y;
     
     
     
    		// Positionnement du panneau
     
    			if (document.getElementById) 
    				{
    				cnt = document.getElementById(nom_div);
    				} 
    			else if (document.all) 
    				{
    				cnt = document.all[nom_div];
    				}
     
    			cnt.style.left = PosSourisHoriz - 151;      // Position horizontale
    			cnt.style.top = PosSourisVerti - 0;      // position verticale	
    	}
    Celui-ci me sert a ouvrir un div au niveau de mon curseur de souris. Cela fonctionne avec IE, mais pas avec Firefox. Voyez vous pourquoi?

  2. #2
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 640
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 640
    Points : 66 665
    Points
    66 665
    Billets dans le blog
    1
    Par défaut
    tu es supposé différentier selon le navigateur non ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     if (document.getElementById)
                {
                cnt = document.getElementById(nom_div);
                }
             else if (document.all)
                {
                cnt = document.all[nom_div];
                }
    ce n'est pas ce que tu fais là ...
    essaye avec if document.layers ...

  3. #3
    Membre régulier Avatar de 12_darte_12
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Février 2005
    Messages
    212
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Haut Rhin (Alsace)

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : Transports

    Informations forums :
    Inscription : Février 2005
    Messages : 212
    Points : 107
    Points
    107
    Par défaut
    J'ai essayé ca :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    			if (document.getElementById) 
    				{
    				cnt = document.getElementById(nom_div);
    				} 
    			else if (document.all) 
    				{
    				cnt = document.all[nom_div];
    				}
    			else if (document.layers)
    				{
    				cnt = document.layers[nom_div];
    				}
    Mais ca ne marche toujours pas.

  4. #4
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 640
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 74
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 640
    Points : 66 665
    Points
    66 665
    Billets dans le blog
    1
    Par défaut
    tu peux mettre le reste du code avec le div stp que je teste ...

  5. #5
    Membre régulier Avatar de 12_darte_12
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Février 2005
    Messages
    212
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Haut Rhin (Alsace)

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : Transports

    Informations forums :
    Inscription : Février 2005
    Messages : 212
    Points : 107
    Points
    107
    Par défaut
    voila mes 3 fichiers au complet spacefrog

    page : index.php

    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
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    	<head>
    		<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
    		<title>GnooCalendar 1.4</title>
     
    <!-- FICHIER DE STYLE DU CALENDRIER //-->
    <link rel='stylesheet' href='gnoocalendar.css' />
    <!-- FICHIER DE SCRIPT DU CALENDRIER //-->
    <script type="text/javascript" src="gnoocalendar.js"></script>
     
    	</head>
     
    <script type="text/javascript">
     
    function position(e,nom_div)
    	{
    		// coordonnées du curseur
     
    				var PosSourisHoriz = 0
    				var PosSourisVerti = 0
     
    			x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
    			y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
     
    				PosSourisHoriz = x;
    				PosSourisVerti = y;
     
     
     
     
    		// Positionnement du panneau
     
    			if (document.getElementById) 
    				{
    				cnt = document.getElementById(nom_div);
    				} 
    			else if (document.all) 
    				{
    				cnt = document.all[nom_div];
    				}
     
    			cnt.style.left = PosSourisHoriz - 151;      // Position horizontale
    			cnt.style.top = PosSourisVerti - 0;      // position verticale	
    	}
     
     
     
    <!--
    /******************************/
    self.defaultStatus = "GnooCalendar 1.4";
    /******************************/
    /* 
    * instanciation de l'objet
    */
    var CL = new GnooCalendar("CL", 20, 10 );
    var CL2 = new GnooCalendar("CL2", 20, 10 );
    /******************************/
    function init()
    {
    	CL.init("calend", document.forms["testform"].elements["testestformield1"]);
    	CL.isDragable(true);
     
    	CL2.init("calend2", document.forms["testform"].elements["testestformield2"]);
    	CL2.isDragable(true);
    }
    /******************************/
    //-->
    </script>
     
    <body onload="init();">
     
    <div id="calend" style="position: absolute; z-index: 99; border: solid 0px #000000;visibility: hidden;">&nbsp;</div>
    <div id="calend2" style="position: absolute; z-index: 99; border: solid 0px #000000;visibility: hidden;">&nbsp;</div>
     
    <form action="aaa.php" method="post" name="testform" target="_self" style='margin:0px;'>
     
    <table border='0' align="center">
    	<tr>
    		<td>date selectionnée : </td>
    		<td><input type='text' name='testestformield1' value='' readonly="" />
    	      <a title="Calendrier" onclick='position(event, "calend"); CL.show(); CL.setTitle("Date de d&eacute;but"); CL.setFree(true);'><img src="b_calendar.png" width="16" height="16" border="0" /></a></td>
    	</tr>
    	<tr>
    		<td>autre date</td>
    		<td><input type='text' name='testestformield2' value='' readonly="" />
          <a title="Calendrier" onclick='position(event, "calend2"); CL2.show(); CL2.setTitle("Date de fin"); CL2.setFree(true);'><img src="b_calendar.png" width="16" height="16" border="0" /></a></td>
    	</tr>
    	<tr>
    		<td><input type='button' name='hide1' onclick='CL.hide();' value='Masquer le calendrier date de d&eacute;but' /></td>
    		<td><input type='button' name='hide2' onclick='CL2.hide();' value='Masquer le calendrier date de fin' /></td>
    	</tr>
    </table>
     
    <p align="center">
      <input type="submit" name="Submit" value="Envoyer" />
    </p>
    </form>
     
     
     
     
    <p>&nbsp;</p>
    <p align="center"><a href="zzz.php" title="souris" target="_self">souris</a></p>
    </body>
    </html>

    page : gnoocalendar.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
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    /******************************
    * GnooCalendar 1.4
    * calendrier dynamique en javascript
    * v1 	27/04/2004
    * v1.1	19/09/2004 + drag&drop
    * v1.2	03/10/2004 + bouton de fermeture 
                       + passage de l'année en paramètre
                       + passage du mois en paramètre
    * v1.3	25/11/2004 + fermeture automatique à la sélection d'une date
    				   + correction bug lié au positionnement lors du masquage
    * v1.4	09/01/2005 + correction bug scrollbar des listes avec Mozilla
    * v1.5  20/03/2005
    * Auteur : zegnoo
    * Contact : gleroy@zegnoo.net
    ******************************/
    function GnooCalendar(n, min, max)
    {
    	this.target= null;
    	this.name =  new String(n);
    	this.tag =  new String();
    	this.title =  new String("Pegasys Logistique");
    	this.date=new Date();
    	this.moving = new Boolean(false);
    	this.vis = new Boolean(false);
    	this.free = new Boolean(false);
    	this.curYear = new Number(this.date.getFullYear());
    	this.maxYear = new Number(this.curYear+max);
    	this.minYear = new Number(this.curYear-min);
    	this.curMonth= new Number(this.date.getMonth());
    /*
    * GnooCalendar.setFree(Boolean vis)
    * affiche ou non des jours feries
    */
    	this.setFree=function(vis)
    	{
    		this.free=vis;
    		if(this.vis==true)
    			this.show();
    		return;
    	}
    /*
    * GnooCalendar.IsDragable(Boolean drag)
    * active/desactive l'option drag&drop 
    */
    	this.isDragable=function(drag)
    	{
    		if(drag==true && !document.layers)
    		{
    			document.onmousemove=this.getMouse;
    			document.getElementById(this.div).root=this;
    			document.getElementById(this.div).onmousedown=this.startMove;
    			document.getElementById(this.div).onmouseup=this.endMove;
    		}
    		return;
    	}
    /*
    * GnooCalendar.startMove()
    * initialise le drag & drop
    */
    	this.startMove=function(evt)
    	{
    		var event;
    		var tmp;
    		if(this.root.vis!=true)
    			return;
    		if(document.all)
    		{
    			event = window.event;
    			tmp = event.srcElement;
    			if(!tmp.form)
    			{
    				this.root.fixX = tmp.offsetLeft+event.offsetX;
    				this.root.fixY = event.offsetY;
    				while(tmp.parentElement!=document.getElementById(this.root.div) && tmp.parentElement!=null )
    				{
    					this.root.fixX += tmp.parentElement.offsetLeft;
    					this.root.fixY += tmp.parentElement.offsetTop;
    					tmp = tmp.parentElement;
    				}
    				this.root.moving=true;
    				self.movingCalendar = this.root;
    				return false;
    			}
    		}
    		else
    		{
    			event = evt;
    			tmp = event.target;
    			if( !tmp.form && tmp.tagName!="SELECT" && tmp.tagName!="OPTION" && tmp.tagName!="scrollbar" )
    			{			
    				this.root.fixX = event.layerX;
    				this.root.fixY = event.layerY;
    				this.root.moving=true;
    				self.movingCalendar = this.root;
    				return false;
    			}
    		}
    		return evt;
    	}
    /*
    * GnooCalendar.endMove()
    * termine le drag & drop
    */
    	this.endMove=function()
    	{
    		if(self.movingCalendar!=null)
    		{
    			self.movingCalendar.moving=false;
    		}
    		return false;
    	}
    /*
    * GnooCalendar.getMouse(Event evt)
    * change la liste des jours feriés jours feries
    */
    	this.getMouse=function(evt)
    	{
     
    		var event;
    		if(document.all)
    		{
    			event = window.event;
    			var scrollObj = (document.documentElement) ? document.documentElement : document.body;
    			this.posX = self.event.clientX+scrollObj.scrollLeft;
    			this.posY = self.event.clientY+scrollObj.scrollTop;
    		}
    		else
    		{
    			event = evt;
    			this.posX = evt.pageX ;
    			this.posY = evt.pageY ;
    		}
    		if(self.movingCalendar!=null)
    		{
    			if(self.movingCalendar.moving==true && self.movingCalendar.vis==true )
    				self.movingCalendar.move(this.posY-self.movingCalendar.fixY, this.posX-self.movingCalendar.fixX);
    		}
    		return false;
    	}
    /*
    * GnooCalendar.move(Number x, Number y)
    * déplace le calendrier
    */
    	this.move=function(x, y)
    	{
    		if(!document.layers)
    		{
    			document.getElementById(this.div).style.top = x+"px";
    			document.getElementById(this.div).style.left = y+"px";
    		}
    		return false;
    	}
     
    /*
    * GnooCalendar.setFreeDay(Array fd)
    * change la liste des jours feriés jours feries
    */
    	this.setFreeDay=function(fd)
    	{
    		this.freeday.length=0;
    		for(var i=0; i<fd.length; i++)
    			this.freeday[i] = new String(fd[i]);
    		if(this.vis==true)
    			this.show();
    		return;
    	}
    /*
    * GnooCalendar.isFreeDay(d,m)
    * true si jour ferié
    */
    	this.isFreeDay=function(d,m)
    	{
    		var tmp = this.checkDate(d)+"/"+this.checkDate(parseInt(m)+1);
    		if(this.free==false)
    			return false;
    		for(var i=0; i<this.freeday.length; i++)
    			if( tmp == this.freeday[i])
    				return true;
    		return false;
    	}
    /*
    * GnooCalendar.setTitle(t)
    * change le titre du calendrier
    */
    	this.setTitle=function(t)
    	{
    		this.title = t;
    		if(this.vis==true)
    			this.show();
    		return;
    	}
    /*
    * GnooCalendar.mList()
    * retourne la liste des mois 
    */
    	this.mList=function()
    	{
    		var tmp = "<table border='0' cellpadding='0' cellspacing='0' class='Gtab'>";
     
    		tmp += "<tr><td align='center' colspan='2' class='Gname'>";
    		if(document.layers)
    		{
    			tmp += "<table width='100%'>";
    			tmp += "<tr>";
    			tmp += "<td class='Gname' align='center'>"+this.title+"</td>";
    			tmp += "<td><a href='javascript://' onclick='"+this.name+".hide();' class='Gname'>X</a></td>";
    			tmp += "</tr>";
    			tmp += "</table>";
    		}
    		else
    		{
    			tmp += "<span style='float:left; text-indent:20px;'>"+this.title+"</span>";
    			tmp += "<span style='float:right;'>";
    			tmp += "<a href='javascript://' onclick='"+this.name+".hide();' class='Gname'>X</a>";
    			tmp += "</span>";
    		}
    		tmp += "</td></tr>";
    		tmp += "<tr>";
    		tmp += "<td class='Gtxt'><select name='"+this.name+"month' class='Gtxt' ";
    		tmp += "onchange='"+this.name+".setMonth(this[this.selectedIndex].value)' >\n";
    		for(var i=0; i<this.month.length; i++)
    		{			
    			tmp += "<option value='"+i+"'";
    			if(this.curMonth==i)
    				tmp += " selected";
    			tmp += ">"+ this.month[i] +"</option>\n";
    		}
    		tmp += "</select></td><td class='Gtxt'>\n";
    		tmp += this.yList();
    		tmp += "</td></tr></table>";
    		tmp += this.dList();
    		return tmp;
    	}
    /*
    * GnooCalendar.yList()
    * retourne la liste des années 
    */
    	this.yList=function()
    	{
    		var tmp = "<select name='"+this.name+"year' class='Gtxt' ";
    		tmp += "onchange='"+this.name+".setYear(this[this.selectedIndex].value);' >\n";
    		for(var i=this.minYear; i<=this.maxYear; i+=1)
    		{
    			tmp += "<option value='"+i+"'";
    			if(this.curYear==i)
    				tmp += " selected";
    			tmp += ">"+ i +"</option>\n";
    		}
    		tmp += "</select>\n";
    		return tmp;
    	}
     
    	this.dayCell=function(d,n)
    	{
    		var tmp = new String("");
    		var now = new Date();
    		if(this.isFreeDay(d,this.curMonth))
    		{
    			tmp += "<td class='Gfree'";
    		}
    		else if (this.checkDate(d)==now.getDate() 
    				&& this.curMonth==now.getMonth()
    				&& this.curYear==now.getFullYear()) 
    		{
    			tmp += "<td class='Gc'";
    		}
    		else
    		{
    			tmp += "<td class='Gc"+n+"'";
    		}
    		if(!document.layers)
    		{
    			tmp += "title='"+this.checkDate(d)+" "+this.month[this.curMonth]+" "+this.curYear+"'";
    			tmp += " onmousedown='"+this.name+".getDate(\"";
    			tmp += this.checkDate(d)+"/";
    			tmp += this.checkDate(1+parseInt(this.curMonth))+"/";
    			tmp += this.curYear+"\"";
    			tmp += ");' ";
    			tmp += " onmouseover='this.className=this.className+\"on\";' ";
    			tmp += " onmouseout='this.className= this.className.substring(0,this.className.indexOf(\"on\"));'";
    		}
    		else
    			tmp += " width='22' height='16' ";
    		tmp += ">";
    		return tmp;
    	}
    /*
    * GnooCalendar.dList()
    * retourne le tableau des jours
    */
    	this.dList=function()
    	{
    		var cur=new Number(1);
    		var tmpDate = new Date();
    		var tmp = new String("<table border='0' cellpadding='0' cellspacing='0' class='Gtab'>");
    		tmpDate.setDate(cur);
    		tmpDate.setMonth(this.curMonth);
    		tmpDate.setFullYear(this.curYear);
    		tmp += "<tr>\n";
    		for(var i=1; i<this.day.length; i++)
    			tmp += "<td class='Gh"+i+"'>"+ this.day[i] +"</td>\n";
    		tmp += "<td class='Gh0'>"+ this.day[0] +"</td>\n";
    		tmp += "</tr>\n";
    		for(var j=0; j<6; j++)
    		{
    			tmp += "<tr>\n";
    			for(var i=1; i<this.day.length; i++)
    			{
    				tmpDate.setDate(cur);			
    				if( cur<=31 && i==tmpDate.getDay() && this.curMonth==tmpDate.getMonth())
    				{
    					tmp += this.dayCell(cur,i);
    					tmp += this.getLink(cur);
    					cur+=1;
    				}
    				else
    				{
    					tmp += "<td class='Gc"+i+"'";
    					tmp += ">&nbsp;";
    				}
    				tmp += "</td>\n";
    				tmpDate.setDate(cur);
    			}
    			if( cur==tmpDate.getDate() && this.curMonth==tmpDate.getMonth())
    			{
    				tmp += this.dayCell(cur,0);
    				tmp += this.getLink(cur);
    				cur+=1;
    			}
    			else
    			{
    				tmp += "<td class='Gc0'";
    				tmp += ">&nbsp;";
    			}
    			tmp += "</td>\n</tr>\n";
    		}
    		tmp += "</table>\n";
    		return tmp;
    	}
    /*
    * GnooCalendar.getLink(c)
    * retourne la balise d'un lien
    */
    	this.getLink = function(c)
    	{
    		var tmp = new String("");
    		if(document.layers)
    		{
    			tmp = "<a href='javascript://' ";
    			tmp += "onclick='"+this.name+".getDate(\"";
    			tmp += this.checkDate(c)+"/";
    			tmp += this.checkDate(1+parseInt(this.curMonth))+"/";
    			tmp += this.curYear+"\"";
    			tmp += ");' class='NSday'>"+(c)+"</a>";
    		}
    		else
    		{
    			tmp = (c);
    		}
    		return tmp;
    	}
    /*
    * GnooCalendar.setMonth( Integer m )
    * modifie le mois à afficher
    */
    	this.setMonth = function(m)
    	{
    		this.curMonth = m;
    		this.show();
    		return;
    	}
    /*
    * GnooCalendar.getYear( Integer y )
    * modifie l'année à afficher
    */
    	this.getYear = function (y)
    	{
    		if(document.layers)
    		{
    			for(var i=0; i<document.layers[this.div].document.forms[this.name+"_form"][this.name+"year"].length; i++)
    			{
    				if(document.layers[this.div].document.forms[this.name+"_form"][this.name+"year"][i].value==y)
    				{
    					document.layers[this.div].document.forms[this.name+"_form"][this.name+"year"].selectedIndex=i;
    					this.setYear(y);
    					return;
    				}
    			}
    		}
    		else
    		{
    			for(var i=0; i<document.forms[this.name+"_form"].elements[this.name+"year"].length; i++)
    			{
    				if(document.forms[this.name+"_form"].elements[this.name+"year"][i].value==y)
    				{
    					document.forms[this.name+"_form"].elements[this.name+"year"].selectedIndex=i;
    					this.setYear(y);
    					return;
    				}
    			}
    		}
    		return;
    	}
    /*
    * GnooCalendar.getMonth( Integer m )
    * modifie le mois à afficher
    */
    	this.getMonth = function (d)
    	{
    		if(document.layers)
    		{
    			for(var i=0; i<document.layers[this.div].document.forms[this.name+"_form"][this.name+"month"].length; i++)
    			{
    				if(document.layers[this.div].document.forms[this.name+"_form"][this.name+"month"][i].value==d)
    				{
    					document.layers[this.div].document.forms[this.name+"_form"][this.name+"month"].selectedIndex=i;
    					this.setMonth(d);
    					return;
    				}
    			}
    		}
    		else
    		{
    			for(var i=0; i<document.forms[this.name+"_form"].elements[this.name+"month"].length; i++)
    			{
    				if(document.forms[this.name+"_form"].elements[this.name+"month"][i].value==d)
    				{
    					document.forms[this.name+"_form"].elements[this.name+"month"].selectedIndex=i;
    					this.setMonth(d);
    					return;
    				}
    			}
    		}
    		return;
    	}
    /*
    * GnooCalendar.setYear( Integer y )
    * modifie l'année à afficher
    */
    	this.setYear = function (y)
    	{
    		this.curYear = y;
    		this.show();
    		return;
    	}
    /*
    * GnooCalendar.setTarget( Object obj )
    * change le champs cible d'affichage de la date
    * BUG OPERA!
    */
    	this.setTarget = function (obj)
    	{
    		this.target = obj;
    		return;
    	}
    /*
    * GnooCalendar.hide()
    * masque le calendrier
    */
    	this.hide = function()
    	{
    		if(document.layers)
    			document.layers[this.div].visibility='hide';
    		else
    		{
    			document.getElementById(this.div).style.visibility = 'hidden';
    			document.getElementById(this.div).style.display = 'none';
    		}
    		this.vis = false;
    		this.endMove();
    		return;
    	}
     
    /*
    * GnooCalendar.getDate()
    * retourne la date selectionnée dans le champs cible
    */
    	this.getDate = function(d)
    	{
    		if(this.target!=null)
    		{
    			this.target.value=d;	
    			this.hide();
    		}
    		return;
    	}
     
    /*
    * GnooCalendar.show()
    * affiche le calendrier
    */
    	this.show = function()
    	{
    		this.vis = true;
    		this.tag = "<form name='"+this.name+"_form' method='post'>\n";
    		this.tag += this.mList();
    		this.tag += "</form>\n";
    		if(document.layers)
    		{
    			with(document.layers[this.div])
    			{				
    				document.open("text/html");
    				document.write(this.tag);
    				document.close();
    				visibility='show';
    			}
    		}
    		else
    		{
    			document.getElementById(this.div).innerHTML = ""+this.tag;
    			document.getElementById(this.div).style.visibility = 'visible';
    			document.getElementById(this.div).style.display = 'block';
    		}
    		return;
    	}
    /*
    * GnooCalendar.init( String d )
    * initialise le Calendrier à la date actuelle
    * paramêtres : 
    * d : nom du calque d'affichage
    * obj : objet dont la propriété value va recevoir le String de la date
    */
    	this.init = function(d, obj)
    	{
    		this.div=d;
    		this.target = obj;
    		this.date=new Date();
    		this.date.setDate(1);		
    		this.curMonth = this.date.getMonth();
    		this.curYear = this.date.getFullYear();
    		if(!self.movingCalendar)
    			self.movingCalendar=null;
    		return;
    	}
    /*
    * GnooCalendar.checkDate( Integer d )
    * paramêtre : le jour d'une date
    */
    	this.checkDate = function(d)
    	{
    		if(parseInt(d)<=9)
    			return "0"+parseInt(d);
    		return parseInt(d);
    	}
    	return this;
    }
    /******************************/
    GnooCalendar.prototype.day = ["D", "L", "M", "M", "J", "V", "S" ];
    GnooCalendar.prototype.month = ["Janvier", 
    				"F&eacute;vrier", 
    				"Mars", 
    				"Avril", 
    				"Mai", 
    				"Juin", 
    				"Juillet", 
    				"Ao&ucirc;t", 
    				"Septembre", 
    				"Octobre", 
    				"Novembre", 
    				"D&eacute;cembre"];
    /* jours feriés français */
    GnooCalendar.prototype.freeday= ["01/01","01/05","08/05","14/07","15/08","01/11","11/11","25/12"];
    /******************************/
    page : gnoocalendar.css
    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
    /* jours pour Netscape */
    .NSday
    {
    	font-family: 	Arial,Helvetica,sans-serif;
    	font-weight: 	bold;
    	font-size:	12px;
    	color:		#0000cc;
    	text-decoration: none;
    }
    /* tableau des jours */
    .Gtab
    {
    	font-family: 	Arial,Helvetica,sans-serif;
    	font-weight: 	normal;
    	font-size:	12px;
    	text-decoration: none;
    	border:	solid 1px #000000;
    	background:#99CC00;
    	width:		152px;
    }
    /* champs nom */
    .Gname
    {
    	font-family: 	Arial,Helvetica,sans-serif;
    	font-weight: 	bold;
    	font-size:	12px;
    	color:		#ffffff;
    	text-decoration: none;
    }
     
    /* champs texte */
    .Gtxt
    {
    	font-family: 	Arial,Helvetica,sans-serif;
    	font-weight: 	normal;
    	font-size:	12px;
    	color:		#6c628a;
    	text-decoration: none;
    	margin-left:	0px;
    }
    /* en-tete semaine */
    .Gh1, .Gh2, .Gh3, .Gh4, .Gh5 /* titre lundi à vendredi */
    {
    	width: 		20px;
    	height: 	16px;
    	font-size:	12px;
    	background:	#000000;
    	border:		solid 1px #FFFFCC;
    	font-family: 	Arial,Helvetica,sans-serif;
    	font-weight: 	bold;
    	color:		#ffffff;
    	text-align:	center;
    	line-height:	16px;
    }
    .Gh0, .Gh6 /* titre samedi à dimanche */
    {
    	width: 		20px;
    	font-size:	12px;
    	height: 	16px;
    	border:		solid 1px #FFFFCC;
    	background:	#000000;
    	font-family: 	Arial,Helvetica,sans-serif;
    	font-weight: 	bold;
    	color:		#ffffff;
    	text-align:	center;
    	line-height:	16px;
    }
    .Gfree /* num jour ferie */
    {
    	width: 		20px;
    	height: 	16px;
    	background:	#006600;
    	border:		solid 1px #FFFFCC;
    	font-family: 	Arial,Helvetica,sans-serif;
    	font-weight: 	normal;
    	padding:	0px;
    	margin:		0px;
    	color:		#FFFFCC;
    	text-align:	center;
    	cursor: 	pointer;
    	line-height:	16px;
    }
    .Gfreeon, .Gcon /* num jour ferie sur focus, gcon pour le jour en cour activé */ 
    {
    	width: 		20px;
    	height: 	16px;
    	background:	#99FF33;
    	border:		solid 1px #000000;
    	font-family: 	Arial,Helvetica,sans-serif;
    	font-weight: 	normal;
    	padding:	0px;
    	margin:		0px;
    	color:		#000000;
    	text-align:	center;
    	cursor: 	pointer;
    	line-height:	16px;
    }
    .Gc1, .Gc2, .Gc3, .Gc4, .Gc5 /* num lundi à vendredi */
    {
    	width: 		20px;
    	height: 	16px;
    	background:	#99CC00;
    	border:		solid 1px #FFFFCC;
    	font-family: 	Arial,Helvetica,sans-serif;
    	font-weight: 	normal;
    	padding:	0px;
    	margin:		0px;
    	color:		#000000;
    	text-align:	center;
    	cursor: 	default;
    	line-height:	16px;
    }
    .Gc1on, .Gc2on, .Gc3on, .Gc4on, .Gc5on /* num lundi à vendredi sur focus */
    {
    	width: 		20px;
    	height: 	16px;
    	background:	#43B72F;
    	border:		solid 1px #000000;
    	font-family: 	Arial,Helvetica,sans-serif;
    	font-weight: 	normal;
    	padding:	0px;
    	margin:		0px;
    	color:		#ffffff;	
    	text-align:	center;
    	cursor: 	pointer;
    	line-height:	16px;
    }
    .Gc0, .Gc6 /* num samedi à dimanche */
    {
    	width: 		20px;
    	height: 	16px;
    	border:		solid 1px #FFFFCC;
    	background:	#43B72F;
    	font-family: 	Arial, Helvetica, sans-serif;
    	font-weight: 	normal;
    	padding:	0px;
    	margin:		0px;
    	color:		#000000;
    	text-align:	center;
    	cursor: 	default;
    	line-height:	16px;
    }
    .Gc0on, .Gc6on /* num samedi à dimanche sur focus */
    {
    	width: 		20px;
    	height: 	16px;
    	border:		solid 1px #000000;
    	background:	#99CC00 ;
    	font-family: 	Arial, Helvetica, sans-serif;
    	font-weight: 	normal;
    	padding:	0px;
    	margin:		0px;
    	color:		#ffffff;
    	text-align:	center;
    	cursor: 	pointer;
    	line-height:	16px;
    }
     
     
    .Gc /* jour en cour */
    {
    	width: 		20px;
    	height: 	16px;
    	border:		solid 1px #ffffff;
    	background: #FFFFCC;
    	font-family: 	Arial, Helvetica, sans-serif;
    	font-weight: 	normal;
    	padding:	0px;
    	margin:		0px;
    	color:		#000000;
    	text-align:	center;
    	cursor: 	default;
    	line-height:	16px;
    }

  6. #6
    Membre averti Avatar de DavidDeTroyes
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2005
    Messages
    305
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Aube (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2005
    Messages : 305
    Points : 348
    Points
    348
    Par défaut
    Je sais pas si ca va t'aider mais voila ce que je fais moi :

    Deja le DIV

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <DIV ID="valeur" STYLE="position:absolute;display:none"></DIV>
    Et voila ce que j'affiche sur un lien

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    ONMOUSEOVER="valeur.style.top = event.y+document.body.scrollTop;valeur.style.left = event.x+15;valeur.style.display = '';valeur.innerHTML = 'toto';" ONMOUSEOUT="valeur.style.display = 'none';"
    Bon ca marche mions bien sur FireFox mais ca marche quand meme

Discussions similaires

  1. Problème de compatibilité avec firefox
    Par djnext dans le forum Mon site
    Réponses: 4
    Dernier message: 15/08/2006, 23h39
  2. [CKEditor] Problème de compatibilité avec FireFox
    Par FzF dans le forum Bibliothèques & Frameworks
    Réponses: 1
    Dernier message: 28/06/2006, 16h07
  3. [AJAX] Affichage avec Firefox
    Par sarapis dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 19/05/2006, 16h00
  4. Problème de proxy avec Firefox
    Par shukin dans le forum Autres langages pour le Web
    Réponses: 3
    Dernier message: 13/12/2005, 12h10
  5. Problème Site Web avec Firefox
    Par bodybug dans le forum Balisage (X)HTML et validation W3C
    Réponses: 5
    Dernier message: 23/01/2005, 23h48

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