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 :

Évènement onclick qui ne fonctionne pas avec FireFox


Sujet :

JavaScript

  1. #1
    Membre confirmé

    Profil pro
    Inscrit en
    Août 2007
    Messages
    496
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 496
    Points : 467
    Points
    467
    Par défaut Évènement onclick qui ne fonctionne pas avec FireFox
    Salut,

    J'ai un petit souci dont je n'ai pas trouvé de réponse.

    En fait j'utilise le code suivant pour ouvrir une palette de couleur et ainsi remplir un champ de formulaire en fonction du choix de l'utilisateur.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    <form name="maForm" action="#" method="post">
    <div id="CP"></div>
    <script language="JavaScript">
    var CP = new Color_Picker("CP");
    </script>
    <input type="text" name="color" size="7">&nbsp;<img src="../images/color.png" width="28" height="31" border="0" align="absmiddle" onClick="CP.Show('color', 'right');">
    </form>
    Bien que tous se passe bien avec Internet Explorer, rien ne se passe sous Firefox ni Opera !

    Voici le code de la palette :

    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
     
    // fonction pour le cas d'appui sur la touche entrée
    function testsubmit() {
        if (document.formulaire.action=="") return false;
    return true ;
    }
    //fonction pour choisir l'action
    function gopage(page)
    {
        document.formulaire.action = page;
        document.formulaire.submit();
    }
     
    var CPArray = new Array();
    var CP_NAMED =
    [
     ["#FF0000", "red"],
     ["#FFFF00", "yellow"],
     ["#00FF00", "lime"],
     ["#00FFFF", "cyan"],
     ["#0000FF", "blue"],
     ["#FF00FF", "magenta"],
     ["#FFFFFF", "white"],
     ["#F5F5F5", "whitesmoke"],
     ["#DCDCDC", "gainsboro"],
     ["#D3D3D3", "lightgrey"],
     ["#C0C0C0", "silver"],
     ["#A9A9A9", "darkgray"],
     ["#808080", "gray"],
     ["#696969", "dimgray"],
     ["#000000", "black"],
     ["#2F4F4F", "darkslategray"],
     ["#708090", "slategray"],
     ["#778899", "lightslategray"],
     ["#4682B4", "steelblue"],
     ["#4169E1", "royalblue"],
     ["#6495ED", "cornflowerblue"],
     ["#B0C4DE", "lightsteelblue"],
     ["#7B68EE", "mediumslateblue"],
     ["#6A5ACD", "slateblue"],
     ["#483D8B", "darkslateblue"],
     ["#191970", "midnightblue"],
     ["#000080", "navy"],
     ["#00008B", "darkblue"],
     ["#0000CD", "mediumblue"],
     ["#1E90FF", "dodgerblue"],
     ["#00BFFF", "deepskyblue"],
     ["#87CEFA", "lightskyblue"],
     ["#87CEEB", "skyblue"],
     ["#ADD8E6", "lightblue"],
     ["#B0E0E6", "powderblue"],
     ["#F0FFFF", "azure"],
     ["#E0FFFF", "lightcyan"],
     ["#AFEEEE", "paleturquoise"],
     ["#48D1CC", "mediumturquoise"],
     ["#20B2AA", "lightseagreen"],
     ["#008B8B", "darkcyan"],
     ["#008080", "teal"],
     ["#5F9EA0", "cadetblue"],
     ["#00CED1", "darkturquoise"],
     ["#00FFFF", "aqua"],
     ["#40E0D0", "turquoise"],
     ["#7FFFD4", "aquamarine"],
     ["#66CDAA", "mediumaquamarine"],
     ["#8FBC8F", "darkseagreen"],
     ["#3CB371", "mediumseagreen"],
     ["#2E8B57", "seagreen"],
     ["#006400", "darkgreen"],
     ["#008000", "green"],
     ["#228B22", "forestgreen"],
     ["#32CD32", "limegreen"],
     ["#00FF00", "lime"],
     ["#7FFF00", "chartreuse"],
     ["#7CFC00", "lawngreen"],
     ["#ADFF2F", "greenyellow"],
     ["#98FB98", "palegreen"],
     ["#90EE90", "lightgreen"],
     ["#00FF7F", "springgreen"],
     ["#00FA9A", "mediumspringgreen"],
     ["#556B2F", "darkolivegreen"],
     ["#6B8E23", "olivedrab"],
     ["#808000", "olive"],
     ["#BDB76B", "darkkhaki"],
     ["#B8860B", "darkgoldenrod"],
     ["#DAA520", "goldenrod"],
     ["#FFD700", "gold"],
     ["#F0E68C", "khaki"],
     ["#EEE8AA", "palegoldenrod"],
     ["#FFEBCD", "blanchedalmond"],
     ["#FFE4B5", "moccasin"],
     ["#F5DEB3", "wheat"],
     ["#FFDEAD", "navajowhite"],
     ["#DEB887", "burlywood"],
     ["#D2B48C", "tan"],
     ["#BC8F8F", "rosybrown"],
     ["#A0522D", "sienna"],
     ["#8B4513", "saddlebrown"],
     ["#D2691E", "chocolate"],
     ["#CD853F", "peru"],
     ["#F4A460", "sandybrown"],
     ["#8B0000", "darkred"],
     ["#800000", "maroon"],
     ["#A52A2A", "brown"],
     ["#B22222", "firebrick"],
     ["#CD5C5C", "indianred"],
     ["#F08080", "lightcoral"],
     ["#FA8072", "salmon"],
     ["#E9967A", "darksalmon"],
     ["#FFA07A", "lightsalmon"],
     ["#FF7F50", "coral"],
     ["#FF6347", "tomato"],
     ["#FF8C00", "darkorange"],
     ["#FFA500", "orange"],
     ["#FF4500", "orangered"],
     ["#DC143C", "crimson"],
     ["#FF0000", "red"],
     ["#FF1493", "deeppink"],
     ["#FF00FF", "fuchsia"],
     ["#FF69B4", "hotpink"],
     ["#FFB6C1", "lightpink"],
     ["#FFC0CB", "pink"],
     ["#DB7093", "palevioletred"],
     ["#C71585", "mediumvioletred"],
     ["#800080", "purple"],
     ["#8B008B", "darkmagenta"],
     ["#9370DB", "mediumpurple"],
     ["#8A2BE2", "blueviolet"],
     ["#4B0082", "indigo"],
     ["#9400D3", "darkviolet"],
     ["#9932CC", "darkorchid"],
     ["#BA55D3", "mediumorchid"],
     ["#DA70D6", "orchid"],
     ["#EE82EE", "violet"],
     ["#DDA0DD", "plum"],
     ["#D8BFD8", "thistle"],
     ["#E6E6FA", "lavender"],
     ["#F8F8FF", "ghostwhite"],
     ["#F0F8FF", "aliceblue"],
     ["#F5FFFA", "mintcream"],
     ["#F0FFF0", "honeydew"],
     ["#FAFAD2", "lightgoldenrodyellow"],
     ["#FFFACD", "lemonchiffon"],
     ["#FFF8DC", "cornsilk"],
     ["#FFFFE0", "lightyellow"],
     ["#FFFFF0", "ivory"],
     ["#FFFAF0", "floralwhite"],
     ["#FAF0E6", "linen"],
     ["#FDF5E6", "oldlace"],
     ["#FAEBD7", "antiquewhite"],
     ["#FFE4C4", "bisque"],
     ["#FFDAB9", "peachpuff"],
     ["#FFEFD5", "papayawhip"],
     ["#FFF5EE", "seashell"],
     ["#FFF0F5", "lavenderblush"],
     ["#FFE4E1", "mistyrose"],
     ["#FFFAFA", "snow"]
    ];
    function Color_Picker(inDIV) {
     this.uID = document.uniqueID;
     CPArray[this.uID] = this;
     this.which = null;
     this.oPopup = window.createPopup();
     this.GetMenuColors = function()
     {
      var str = "", i = 0, j = 0, k = 0, tdDisp = 0, totDisp = 0, fDisp = 0, aHex;
      str += "<DIV ID=\"ColorMenu_" + this.uID + "\" STYLE=\"display:none;\">";
      str += "<table id=\"Named_" + this.uID + "\" cellpadding=\"1\" cellspacing=\"2\" border=\"1\" bordercolor=\"#666666\" style=\"font-family: Verdana; font-size: 7px; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 2px solid; BORDER-TOP: buttonhighlight 1px solid; BORDER-BOTTOM: buttonshadow 1px solid; table-layout; fixed;\" bgcolor=\"buttonface\" width=\"100%\" height=\"100%\">";
      str += "<tr><td align=\"center\" colspan=\"16\" style=\"height: 20px;border:1px solid buttonface;font-family: verdana; font-size:12px;\">";
      str += "<font color=\"#FF0000\">Nommé</font> - ";
      str += "<a style=\"cursor:hand;\" onClick=\"javascript:parent.CPArray['" + this.uID + "'].ToggleColor(Gray_" + this.uID + ", Named_" + this.uID + ", Safe_" + this.uID + ");\">Échelle de gris</a> - ";
      str += "<a style=\"cursor:hand;\" onClick=\"javascript:parent.CPArray['" + this.uID + "'].ToggleColor(Safe_" + this.uID + ", Named_" + this.uID + ", Gray_" + this.uID + ");\">Sécurité</a>";
      str += "</td></tr>";
      str += "<tr><td colspan=\"16\" id=\"NamedColor_" + this.uID + "\" style=\"height: 20px;font-family: verdana; font-size:12px;\">&nbsp;</td></tr>";
      str += "<tr><td width=\"100%\" colspan=\"16\" id=\"NamedName_" + this.uID + "\" style=\"height: 20px;border: 1px solid buttonface; font-family: verdana; font-size:9px;\" align=\"left\">&nbsp;</td>";
      str += "</tr>";
      str += "<tr><td colspan=\"16\" onMouseOver=\"parent.CPArray['" + this.uID + "'].ShowColor(NamedColor_" + this.uID + ", NamedName_" + this.uID + ", this, '');\" style=\"height: 20px;font-family: verdana; font-size:10px;cursor: hand;\" align=\"center\" onClick=\"parent.CPArray['" + this.uID + "'].DoColor('');\">Aucune</td></tr>";
      str += "<tr>";
      for (i = 0; i < CP_NAMED.length; i++) {
       if (i % 16 == 0 && i != 0) {
        str += "</tr>";
        str += "<tr>";
        tdDisp = 0;
       }
       str += "<td style=\"height:12px;width:12px;cursor: hand;background-color:'" + CP_NAMED[i][0] + "'; font-size: 0px;\"";
       str += " onMouseOver=\"parent.CPArray['" + this.uID + "'].ShowColor(NamedColor_" + this.uID + ", NamedName_" + this.uID + ", this, '" + CP_NAMED[i][1] + "');\"";
       str += " onClick=\"parent.CPArray['" + this.uID + "'].DoColor('" + CP_NAMED[i][0] + "');\">" + String.fromCharCode(160) + "</td>";
       tdDisp++;
       totDisp++;
      };
      for (i = tdDisp; i < 16; i++) {
       str += "<td style=\"height:12px;width:12px;border: 1px solid buttonface; background-color:buttonface; font-size: 0px;\"";
       str += " onMouseOver=\"parent.CPArray['" + this.uID + "'].ShowColor(NamedColor_" + this.uID + ", NamedName_" + this.uID + ", this, '');\">" + String.fromCharCode(160) + "</td>";
       totDisp++;
      };
      str += "</tr>";
      str += "<tr>";
      fDisp = totDisp;
      for (i = totDisp; i < (16 * 16); i++) {
       if (i % 16 == 0 && i != fDisp) {
        str += "</tr>";
        str += "<tr>";
       }
       str += "<td style=\"height:12px;width:12px;border: 1px solid buttonface; background-color:buttonface; font-size: 0px;\"";
       str += " onMouseOver=\"parent.CPArray['" + this.uID + "'].ShowColor(NamedColor_" + this.uID + ", NamedName_" + this.uID + ", this, '');\">" + String.fromCharCode(160) + "</td>";
      };
      str += "</tr>";
      str += "</table>";
      aHex = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
      str += "<table id=\"Gray_" + this.uID + "\" cellpadding=\"1\" cellspacing=\"2\" border=\"1\" bordercolor=\"#666666\" style=\"font-family: Verdana; font-size: 7px; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 2px solid; BORDER-TOP: buttonhighlight 1px solid; BORDER-BOTTOM: buttonshadow 1px solid; table-layout; fixed;display: none;\" bgcolor=\"buttonface\" width=\"100%\" height=\"100%\">";
      str += "<tr><td align=\"center\" colspan=\"16\" style=\"height:20px;border:1px solid buttonface;font-family: verdana; font-size:12px;\">";
      str += "<a style=\"cursor:hand;\" onClick=\"javascript:parent.CPArray['" + this.uID + "'].ToggleColor(Named_" + this.uID + ", Gray_" + this.uID + ", Safe_" + this.uID + ");\">Nommé</a> - ";
      str += "<font color=\"#FF0000\">Échelle de gris</font> - ";
      str += "<a style=\"cursor:hand;\" onClick=\"javascript:parent.CPArray['" + this.uID + "'].ToggleColor(Safe_" + this.uID + ", Named_" + this.uID + ", Gray_" + this.uID + ");\">Sécurité</a>";
      str += "</td></tr>";
      str += "<tr><td colspan=\"16\" id=\"GrayColor_" + this.uID + "\" style=\"height:20px;font-family: verdana; font-size:12px;\">&nbsp;</td></tr>";
      str += "<tr><td colspan=\"16\" id=\"GrayName_" + this.uID + "\" style=\"height:20px;border: 1px solid buttonface; font-family: verdana; font-size:10px;\" align=\"left\">&nbsp;</td></tr>";
      str += "<tr><td onMouseOver=\"parent.CPArray['" + this.uID + "'].ShowColor(GrayColor_" + this.uID + ", GrayName_" + this.uID + ", this, '');\" colspan=\"16\" style=\"height:20px;font-family: verdana; font-size:10px;cursor: hand;\" align=\"center\" onClick=\"parent.CPArray['" + this.uID + "'].DoColor('');\">Aucune</td></tr>";
      str += "<tr>";
      for (i = 0; i < aHex.length; i++) {
       for (j = 0; j < aHex.length; j++) {
        str += "<td style=\"height:12px;width:12px;cursor: hand;background-color:'#" + aHex[i] + aHex[j] + aHex[i] + aHex[j] + aHex[i] + aHex[j] + "'; font-size: 0px;\"";
        str += " onMouseOver=\"parent.CPArray['" + this.uID + "'].ShowColor(GrayColor_" + this.uID + ", GrayName_" + this.uID + ", this, '');\"";
        str += " onClick=\"parent.CPArray['" + this.uID + "'].DoColor('#" + aHex[i] + aHex[j] + aHex[i] + aHex[j] + aHex[i] + aHex[j] + "');\">" + String.fromCharCode(160) + "</td>";
       };
       if (i < aHex.length - 1) {
         str += "</tr>";
         str += "<tr>";
       }
      };
      str += "</tr>";
      str += "</table>";
      aHex = new Array("00","33","66","99","CC","FF");
      tdDisp = 0;
      totDisp = 0;
      str += "<table id=\"Safe_" + this.uID + "\" cellpadding=\"1\" cellspacing=\"2\" border=\"1\" bordercolor=\"#666666\" style=\"font-family: Verdana; font-size: 7px; BORDER-LEFT: buttonhighlight 1px solid; BORDER-RIGHT: buttonshadow 2px solid; BORDER-TOP: buttonhighlight 1px solid; BORDER-BOTTOM: buttonshadow 1px solid; table-layout; fixed;display: none;\" bgcolor=\"buttonface\" width=\"100%\" height=\"100%\">";
      str += "<tr><td align=\"center\" colspan=\"16\" style=\"height:20px;border:1px solid buttonface;font-family: verdana; font-size:12px;\">";
      str += "<a style=\"cursor:hand;\" onClick=\"javascript:parent.CPArray['" + this.uID + "'].ToggleColor(Named_" + this.uID + ", Gray_" + this.uID + ", Safe_" + this.uID + ");\">Nommé</a> - ";
      str += "<a style=\"cursor:hand;\" onClick=\"javascript:parent.CPArray['" + this.uID + "'].ToggleColor(Gray_" + this.uID + ", Named_" + this.uID + ", Safe_" + this.uID + ");\">Échelle de gris</a> - ";
      str += "<font color=\"#FF0000\">Sécurité</font>";
      str += "</td></tr>";
      str += "<tr><td colspan=\"16\" id=\"SafeColor_" + this.uID + "\" style=\"height:20px;font-family: verdana; font-size:12px;\">&nbsp;</td></tr>";
      str += "<tr><td colspan=\"16\" id=\"SafeName_" + this.uID + "\" style=\"height:20px;border: 1px solid buttonface; font-family: verdana; font-size:10px;\" align=\"left\">&nbsp;</td></tr>";
      str += "<tr><td colspan=\"16\" onMouseOver=\"parent.CPArray['" + this.uID + "'].ShowColor(SafeColor_" + this.uID + ", SafeName_" + this.uID + ", this, '');\" style=\"height:20px;font-family: verdana; font-size:10px;cursor: hand;\" align=\"center\" onClick=\"parent.CPArray['" + this.uID + "'].DoColor('');\">Aucune</td></tr>";
      str += "<tr>";
      for (i = 0; i < aHex.length; i++) {
       for (j = 0; j < aHex.length; j++) {
        for (k = 0; k < aHex.length; k++) {
         if (totDisp % 16 == 0 && totDisp != 0) {
          str += "</tr>";
          str += "<tr>";
          tdDisp = 0;
         }
         str += "<td style=\"height:12px;width:12px;cursor: hand;background-color:'#" + aHex[i] + aHex[j] + aHex[k] + "'; font-size: 0px;\"";
         str += " onMouseOver=\"parent.CPArray['" + this.uID + "'].ShowColor(SafeColor_" + this.uID + ", SafeName_" + this.uID + ", this, '');\"";
         str += " onClick=\"parent.CPArray['" + this.uID + "'].DoColor('#" + aHex[i] + aHex[j] + aHex[k] + "');\">" + String.fromCharCode(160) + "</td>";
         tdDisp++;
         totDisp++;
        };
       };
      };
      for (i = tdDisp; i < 16; i++) {
       str += "<td style=\"height:12px;width:12px;border: 1px solid buttonface; background-color:buttonface; font-size: 0px;\"";
       str += " onMouseOver=\"parent.CPArray['" + this.uID + "'].ShowColor(SafeColor_" + this.uID + ", SafeName_" + this.uID + ", this, '');\">" + String.fromCharCode(160) + "</td>";
       totDisp++;
      };
      str += "</tr>";
      str += "<tr>";
      fDisp = totDisp;
      for (i = totDisp; i < (16 * 16); i++) {
       if (i % 16 == 0 && i != fDisp) {
        str += "</tr>";
        str += "<tr>";
       }
       str += "<td style=\"height:12px;width:12px;border: 1px solid buttonface; background-color:buttonface; font-size: 0px;\"";
       str += " onMouseOver=\"parent.CPArray['" + this.uID + "'].ShowColor(SafeColor_" + this.uID + ", SafeName_" + this.uID + ", this, '');\">" + String.fromCharCode(160) + "</td>";
      };
      str += "</tr>";
      str += "</table>";
      str += "</DIV>";
      return str;
     };
     this.ToggleColor = function( inCOLORON, inCOLOROFF, inCOLOROFF_2 )
     {
      inCOLORON.style.display = "";
      inCOLOROFF.style.display = "none";
      inCOLOROFF_2.style.display = "none";
     };
     this.ShowColor = function( inTDC, inTDT, inTD, inTXT)
     {
      var str = "";
      if (inTXT != "") {
       inTDT.innerHTML = inTD.style.backgroundColor.toUpperCase() + " " + inTXT;
      } else {
       inTDT.innerHTML = inTD.style.backgroundColor.toUpperCase().replace("BUTTONFACE", "");
      }
      inTDC.style.backgroundColor = inTD.style.backgroundColor;
     };
     this.DoColor = function( inCOLOR )
     {
      document.all[this.which].value = inCOLOR;
      this.which = null;
      this.open = null;
      this.oPopup.hide();
     
      // permet de changer la couleur du texte dans le tableau exemple
    document.getElementById('exemple').style.color=document.getElementsByName('color')[0].value;
     };
     this.Show = function( inFORM, inPOS )
     {
      this.which = inFORM;
      this.open = inPOS;
      this.ShowMenu('ColorMenu_' + this.uID, 240, 320);
     };
     this.ShowMenu = function( inMENU, inW, inH)
     {
      var oPopBody = this.oPopup.document.body;
      var HTMLContent = eval(inMENU).innerHTML;
      oPopBody.innerHTML = HTMLContent;
      oPopBody.onselectstart = function() {return false;};
      oPopBody.ondragstart = function() {return false;};
      oPopBody.oncontextmenu = function() {return false;};
      if (this.open == "center") {
       var leftPos = (screen.availWidth - inW) / 2;
       var topPos = (screen.availHeight - inH) / 2;
       this.oPopup.show(leftPos, topPos, inW, inH, document.body);
      } else if (this.open == "bottom") {
       var lefter = event.clientX;
       var leftoff = event.offsetX;
       var topper = event.clientY;
       var topoff = event.offsetY;
       this.oPopup.show(lefter - leftoff - 2, topper - topoff + 22, inW, inH, document.body);
      } else if (this.open == "right") {
       var lefter = event.clientX;
       var leftoff = event.offsetX;
       var topper = event.clientY;
       var topoff = event.offsetY;
       this.oPopup.show(lefter - leftoff + 22, topper - topoff - 2, inW, inH, document.body);
      }
      return false;
     };
     this.Init = function()
     {
      var str = document.getElementById(inDIV).innerHTML;
      str += this.GetMenuColors();
      document.getElementById(inDIV).innerHTML = str;
     };
     this.Init();
    };


    Avant de poster faites une recherche et/ou consultez la FAQ.

    Un sujet est résolu n'oubliez pas le tag

  2. #2
    Expert éminent sénior

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Points : 36 571
    Points
    36 571
    Par défaut
    Bonjour,
    pas eu le temps de tout regarder, mais ça ne marcherait pas mieux avec
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    document.forms['formulaire']....
    plutôt que (déprécié)

    A+
    Pour tout savoir sur l'utilisation du forum

    En postant votre message, n'oubliez pas les Règles du Club.

  3. #3
    Membre confirmé

    Profil pro
    Inscrit en
    Août 2007
    Messages
    496
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 496
    Points : 467
    Points
    467
    Par défaut
    Merci E.Bzz je viens de tester mais ceela ne change rien !


    Avant de poster faites une recherche et/ou consultez la FAQ.

    Un sujet est résolu n'oubliez pas le tag

  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 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    onClick="CP.Show('color', 'right');"
    CP.Show ??
    c'est quoi CP ?
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  5. #5
    Membre confirmé

    Profil pro
    Inscrit en
    Août 2007
    Messages
    496
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 496
    Points : 467
    Points
    467
    Par défaut
    C'est un code que j'ai récupérer sur la toile.

    CP doit correspondre a l'appel de la palette contenant les différentes couleur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    <form name="maForm" action="#" method="post">
    <div id="CP"></div>
    <script language="JavaScript">
    var CP = new Color_Picker("CP");
    </script>
    <input type="text" name="color" size="7">&nbsp;<img src="../images/color.png" width="28" height="31" border="0" align="absmiddle" onClick="CP.Show('color', 'right');">
    </form>
    Pour CP.Show je ne voit pas !


    Avant de poster faites une recherche et/ou consultez la FAQ.

    Un sujet est résolu n'oubliez pas le tag

  6. #6
    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 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     this.oPopup = window.createPopup();
    propriétaire IE ça ! Donc normal que cela ne focntionne qu'avec IE ...
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  7. #7
    Membre confirmé

    Profil pro
    Inscrit en
    Août 2007
    Messages
    496
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 496
    Points : 467
    Points
    467
    Par défaut
    Y a t'il une solution valable pour tous les navigateurs alors ?


    Avant de poster faites une recherche et/ou consultez la FAQ.

    Un sujet est résolu n'oubliez pas le tag

  8. #8
    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 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    trouver un autre code ... ??
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  9. #9
    Membre confirmé

    Profil pro
    Inscrit en
    Août 2007
    Messages
    496
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 496
    Points : 467
    Points
    467
    Par défaut
    Citation Envoyé par SpaceFrog Voir le message
    trouver un autre code ... ??
    Oui pourquoi pas !

    Mais il doit bien exister une commande universelle !!!!!!


    Avant de poster faites une recherche et/ou consultez la FAQ.

    Un sujet est résolu n'oubliez pas le tag

  10. #10
    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 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    il faudrait modifer le code de façon a ne pas utiliser ce type d'objet popup spécifique à IE.
    Donc non il n'existe pas de commande universelle.
    un window.open() ne convient pas puisqu'il ne permet pas de gérer l'affichage au moment souhaité de cette "popup"

    Il faudrait donc remanier en profondeur le code pour y adjoindre par exemple une librairie du type prototype window qui permet d'emuler des popup en permettant de gérer leur affichage.
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  11. #11
    Membre confirmé

    Profil pro
    Inscrit en
    Août 2007
    Messages
    496
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 496
    Points : 467
    Points
    467
    Par défaut
    Ok bon ça ressemble a du travail de fourmi et vu que je n'y connai pas grand chose en javascript ça le fait pas.

    J'ai vais donc voir pour trouver autre chose !

    Merci quand même


    Avant de poster faites une recherche et/ou consultez la FAQ.

    Un sujet est résolu n'oubliez pas le tag

  12. #12
    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 669
    Points
    66 669
    Billets dans le blog
    1
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  13. #13
    Membre confirmé

    Profil pro
    Inscrit en
    Août 2007
    Messages
    496
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 496
    Points : 467
    Points
    467
    Par défaut
    SpaceFrog c'est ce dont j'ai besoin, je vais étudier ça ce soir ou demain car malheureusement je doit m'absenter.


    Avant de poster faites une recherche et/ou consultez la FAQ.

    Un sujet est résolu n'oubliez pas le tag

  14. #14
    Rédacteur

    Avatar de Bovino
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    23 647
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2008
    Messages : 23 647
    Points : 91 220
    Points
    91 220
    Billets dans le blog
    20
    Par défaut
    Un autre :
    ici
    Pas de question technique par MP !
    Tout le monde peut participer à developpez.com, vous avez une idée, contactez-moi !
    Mes formations video2brain : La formation complète sur JavaScriptJavaScript et le DOM par la pratiquePHP 5 et MySQL : les fondamentaux
    Mon livre sur jQuery
    Module Firefox / Chrome d'intégration de JSFiddle et CodePen sur le forum

  15. #15
    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 669
    Points
    66 669
    Billets dans le blog
    1
    Par défaut
    Beef pas de bol le tiens fonctionne avec popup docn si tu paramètre firefox pour ouvrir les popup dans un nouvel onglet ...
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

  16. #16
    Rédacteur

    Avatar de Bovino
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    23 647
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2008
    Messages : 23 647
    Points : 91 220
    Points
    91 220
    Billets dans le blog
    20
    Par défaut
    Non, pas le 2e exemple...
    Pas de question technique par MP !
    Tout le monde peut participer à developpez.com, vous avez une idée, contactez-moi !
    Mes formations video2brain : La formation complète sur JavaScriptJavaScript et le DOM par la pratiquePHP 5 et MySQL : les fondamentaux
    Mon livre sur jQuery
    Module Firefox / Chrome d'intégration de JSFiddle et CodePen sur le forum

  17. #17
    Membre confirmé

    Profil pro
    Inscrit en
    Août 2007
    Messages
    496
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 496
    Points : 467
    Points
    467
    Par défaut
    J'ai trouver une palette de couleur qui me convient.

    Voici le code de la page tels que je l'utilise :

    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
    <html>
    <head>
    <title>test</title>
    <style type="text/css">
    TABLE, THEAD, TBODY, TFOOT, TH, TR, TD {
     margin : 0px;
     padding : 0px;
     border-spacing : 0px;
    }
    FIELDSET {
     padding : 0px;
     margin : 0px;
     color : black;
    }
    LEGEND {
     font-family : Tahoma;
     font-size : 10pt;
     color : black;
    }
    A.color, A.color:active, A.color:visited {
     position : relative;
     display : block;
     text-decoration : none;
     width : 10px;
     height : 10px;
     line-height : 10px;
     margin : 0px;
     padding : 0px;
     border : 1px inset white;
    }
    A.color:hover {
     border : 1px outset white;
    }
    A.none, A.none:active, A.none:visited, A.none:hover {
     position : relative;
     display : block;
     text-decoration : none;
     width : 10px;
     height : 10px;
     line-height : 10px;
     margin : 0px;
     padding : 0px;
     cursor : default;
     border : 1px solid threedface;
    }
    .tblColor {
     display : none;
    }
    .tdColor {
     padding : 1px;
    }
    .tblContainer {
     background-color : threedface;
    }
    .tblGlobal {
     position : absolute;
     top : 0px;
     left : 0px;
     display : none;
     background-color : threedface;
     border : 2px outset;
    }
    .tdContainer {
     padding : 5px;
    }
    .tdDisplay {
     width : 50%;
     height : 20px;
     line-height : 20px;
     border : 1px outset white;
    }
    .tdDisplayTxt {
     width : 50%;
     height : 24px;
     line-height : 12px;
     font-family : Tahoma;
     font-size : 8pt;
     color : black;
     text-align : center;
    }
    .btnColor {
     width : 100%;
     font-family : Tahoma;
     font-size : 10pt;
     padding : 0px;
     margin : 0px;
    }
    .btnPalette {
     width : 100%;
     font-family : Tahoma;
     font-size : 8pt;
     padding : 0px;
     margin : 0px;
    }
    </style>
     
    <script type="text/javascript">
    StringBuilder = function()
    {
     this.arrStr = new Array();
     this.Append = function( inVAL )
     {
      this.arrStr[this.arrStr.length] = inVAL;
     }
     this.toString = function()
     {
      return this.arrStr.join('');
     }
     this.Init = function()
     {
      this.arrStr = null;
      this.arrStr = new Array();
     }
    }
     
    var objSB = new StringBuilder();
     
    var arrGray = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
    var arrSafe = new Array('00','33','66','99','CC','FF');
    var arrSys = [['D4D0C8', 'ActiveBorder'],['0A246A', 'ActiveCaption'],['808080', 'AppWorkspace'],['3A6EA5', 'Background'],['D4D0C8', 'ButtonFace'],['FFFFFF', 'ButtonHighlight'],['808080', 'ButtonShadow'],['000000', 'ButtonText'],['FFFFFF', 'CaptionText'],['808080', 'GrayText'],['0A246A', 'Highlight'],['FFFFFF', 'HighlightText'],['D4D0C8', 'InactiveBorder'],['0A246A', 'InactiveCaption'],['D4D0C8', 'InactiveCaptionText'],['FFFFE1', 'InfoBackground'],['000000', 'InfoText'],['D4D0C8', 'Menu'],['000000', 'MenuText'],['D4D0C8', 'Scrollbar'],['404040', 'ThreedDarkShadow'],['D4D0C8', 'ThreedFace'],['FFFFFF', 'ThreedHighlight'],['D4D0C8', 'ThreedLightShadow'],['808080', 'ThreedShadow'],['FFFFFF', 'Window'],['000000', 'WindowFrame'],['000000', 'WindowText']];
    var arrName = [['FF0000', 'red'],['FFFF00', 'yellow'],['00FF00', 'lime'],['00FFFF', 'cyan'],['0000FF', 'blue'],['FF00FF', 'magenta'],['FFFFFF', 'white'],['F5F5F5', 'whitesmoke'],['DCDCDC', 'gainsboro'],['D3D3D3', 'lightgrey'],['C0C0C0', 'silver'],['A9A9A9', 'darkgray'],['808080', 'gray'],['696969', 'dimgray'],['000000', 'black'],['2F4F4F', 'darkslategray'],['708090', 'slategray'],['778899', 'lightslategray'],['4682B4', 'steelblue'],['4169E1', 'royalblue'],['6495ED', 'cornflowerblue'],['B0C4DE', 'lightsteelblue'],['7B68EE', 'mediumslateblue'],['6A5ACD', 'slateblue'],['483D8B', 'darkslateblue'],['191970', 'midnightblue'],['000080', 'navy'],['00008B', 'darkblue'],['0000CD', 'mediumblue'],['1E90FF', 'dodgerblue'],['00BFFF', 'deepskyblue'],['87CEFA', 'lightskyblue'],['87CEEB', 'skyblue'],['ADD8E6', 'lightblue'],['B0E0E6', 'powderblue'],['F0FFFF', 'azure'],['E0FFFF', 'lightcyan'],['AFEEEE', 'paleturquoise'],['48D1CC', 'mediumturquoise'],['20B2AA', 'lightseagreen'],['008B8B', 'darkcyan'],['008080', 'teal'],['5F9EA0', 'cadetblue'],['00CED1', 'darkturquoise'],['00FFFF', 'aqua'],['40E0D0', 'turquoise'],['7FFFD4', 'aquamarine'],['66CDAA', 'mediumaquamarine'],['8FBC8F', 'darkseagreen'],['3CB371', 'mediumseagreen'],['2E8B57', 'seagreen'],['006400', 'darkgreen'],['008000', 'green'],['228B22', 'forestgreen'],['32CD32', 'limegreen'],['00FF00', 'lime'],['7FFF00', 'chartreuse'],['7CFC00', 'lawngreen'],['ADFF2F', 'greenyellow'],['98FB98', 'palegreen'],['90EE90', 'lightgreen'],['00FF7F', 'springgreen'],['00FA9A', 'mediumspringgreen'],['556B2F', 'darkolivegreen'],['6B8E23', 'olivedrab'],['808000', 'olive'],['BDB76B', 'darkkhaki'],['B8860B', 'darkgoldenrod'],['DAA520', 'goldenrod'],['FFD700', 'gold'],['F0E68C', 'khaki'],['EEE8AA', 'palegoldenrod'],['FFEBCD', 'blanchedalmond'],['FFE4B5', 'moccasin'],['F5DEB3', 'wheat'],['FFDEAD', 'navajowhite'],['DEB887', 'burlywood'],['D2B48C', 'tan'],['BC8F8F', 'rosybrown'],['A0522D', 'sienna'],['8B4513', 'saddlebrown'],['D2691E', 'chocolate'],['CD853F', 'peru'],['F4A460', 'sandybrown'],['8B0000', 'darkred'],['800000', 'maroon'],['A52A2A', 'brown'],['B22222', 'firebrick'],['CD5C5C', 'indianred'],['F08080', 'lightcoral'],['FA8072', 'salmon'],['E9967A', 'darksalmon'],['FFA07A', 'lightsalmon'],['FF7F50', 'coral'],['FF6347', 'tomato'],['FF8C00', 'darkorange'],['FFA500', 'orange'],['FF4500', 'orangered'],['DC143C', 'crimson'],['FF0000', 'red'],['FF1493', 'deeppink'],['FF00FF', 'fuchsia'],['FF69B4', 'hotpink'],['FFB6C1', 'lightpink'],['FFC0CB', 'pink'],['DB7093', 'palevioletred'],['C71585', 'mediumvioletred'],['800080', 'purple'],['8B008B', 'darkmagenta'],['9370DB', 'mediumpurple'],['8A2BE2', 'blueviolet'],['4B0082', 'indigo'],['9400D3', 'darkviolet'],['9932CC', 'darkorchid'],['BA55D3', 'mediumorchid'],['DA70D6', 'orchid'],['EE82EE', 'violet'],['DDA0DD', 'plum'],['D8BFD8', 'thistle'],['E6E6FA', 'lavender'],['F8F8FF', 'ghostwhite'],['F0F8FF', 'aliceblue'],['F5FFFA', 'mintcream'],['F0FFF0', 'honeydew'],['FAFAD2', 'lightgoldenrodyellow'],['FFFACD', 'lemonchiffon'],['FFF8DC', 'cornsilk'],['FFFFE0', 'lightyellow'],['FFFFF0', 'ivory'],['FFFAF0', 'floralwhite'],['FAF0E6', 'linen'],['FDF5E6', 'oldlace'],['FAEBD7', 'antiquewhite'],['FFE4C4', 'bisque'],['FFDAB9', 'peachpuff'],['FFEFD5', 'papayawhip'],['FFF5EE', 'seashell'],['FFF0F5', 'lavenderblush'],['FFE4E1', 'mistyrose'],['FFFAFA', 'snow']];
     
    var intTdDisp = intTblDisp = 0;
    var i = j = k = 0;
    var objCurrent = objGray = objSafe = objSys = objName = objLegend = objPreview = objSelected = objPreviewTxt = objSelectedTxt = objGlobal = null;
    var strColor = '', strColorTxt = '', strCurrent = '';
     
    fctTblFeed = function()
    {
     if (intTdDisp != 16) {
      for (i = intTdDisp; i < 16; i++) {
       objSB.Append('<td class="tdColor"><a class="none" href="#">&nbsp;</a></td>');
       intTblDisp++;
      }
     }
     if (intTblDisp != 256) {
      for (i = intTblDisp; i < 256; i++) {
       if (i % 16 == 0) {objSB.Append('</tr><tr>');}
       objSB.Append('<td class="tdColor"><a class="none" href="#">&nbsp;</a></td>');
      }
     }
    }
     
    fctIsInSys = function(strColor)
    {
     var strOut = '';
     for (ii = 0; ii < arrSys.length; ii++) {
      if (arrSys[ii][0] == strColor) {strOut = arrSys[ii][1]; break;}
     }
     return strOut;
    }
     
    fctIsInName = function(strColor)
    {
     var strOut = '';
     for (ii = 0; ii < arrName.length; ii++) {
      if (arrName[ii][0] == strColor) {strOut = arrName[ii][1]; break;}
     }
     return strOut;
    }
     
    fctOver = function(strColor, strTxt)
    {
     objPreview.style.backgroundColor = strColor;
     objPreviewTxt.innerHTML = strColor + '<br>' + strTxt;
    }
     
    fctOut = function()
    {
     objPreview.style.backgroundColor = '';
     objPreviewTxt.innerHTML = '';
    }
     
    fctSetColor = function(strColor, strTxt)
    {
     strCurrent = strColor;
     objSelected.style.backgroundColor = strColor;
     objSelectedTxt.innerHTML = strColor + '<br>' + strTxt;
    }
     
    fctSelect = function(strArr, strTxt)
    {
     objLegend.innerHTML = '&nbsp;' + strTxt + '&nbsp;';
     objGray.style.display = (strArr == 'Gray') ? 'block' : 'none';
     objSafe.style.display = (strArr == 'Safe') ? 'block' : 'none';
     objSys.style.display = (strArr == 'Sys') ? 'block' : 'none';
     objName.style.display = (strArr == 'Name') ? 'block' : 'none';
    }
     
    fctHide = function()
    {
     fctReset();
     objGlobal.style.display = 'none';
     objCurrent = null;
    }
     
    fctReset = function()
    {
     objSelected.style.backgroundColor = '';
     objSelectedTxt.innerHTML = '';
     strCurrent = '';
    }
     
    fctOk = function()
    {
     objCurrent.value = strCurrent.toUpperCase();
     fctHide();
      // permet de changer la couleur du texte dans le tableau exemple
    document.getElementById('exemple').style.color=document.getElementsByName('color')[0].value;
    }
     
    fctShow = function(objForm)
    {
     if (objForm) {
      objCurrent = objForm;
      if (objForm.value + '' != '') {
       strColor = objForm.value.replace('#', '');
       strColorTxt = '' + fctIsInName(strColor);
       if (strColorTxt == '') {strColorTxt = '' + fctIsInSys(strColor);}
       fctSetColor('#' + strColor, strColorTxt)
      } else {
       fctReset();
      }
      fctSelect('Name', 'Named');
     }
     if (objCurrent) {
      var w = h = t = l = 0;
      if (self.innerHeight) {
       w = self.innerWidth;
       h = self.innerHeight;
      } else if (document.documentElement && document.documentElement.clientHeight) {
       w = document.documentElement.clientWidth;
       h = document.documentElement.clientHeight;
      } else if (document.body) {
       w = document.body.clientWidth;
       h = document.body.clientHeight;
      }
      if (self.pageYOffset) {
       l = self.pageXOffset;
       t = self.pageYOffset;
      } else if (document.documentElement && document.documentElement.scrollTop) {
       l = document.documentElement.scrollLeft;
       t = document.documentElement.scrollTop;
      } else if (document.body) {
       l = document.body.scrollLeft;
       t = document.body.scrollTop;
      }
      if (objGlobal.style.display != 'block') {objGlobal.style.display = 'block';}
      objGlobal.style.top = parseInt(((h - objGlobal.offsetHeight) / 2) + t, 10) + 'px';
      objGlobal.style.left = parseInt(((w - objGlobal.offsetWidth) / 2) + l, 10) + 'px';
     }
    }
     
    fctLoad = function()
    {
     var objDiv = document.createElement('DIV');
     objDiv.id = 'objCP';
     objDiv.style.display = 'inline';
     document.body.appendChild(objDiv);
     objDiv.innerHTML = objSB.toString();
     objPreview = document.getElementById('objPreview');
     objSelected = document.getElementById('objSelected');
     objPreviewTxt = document.getElementById('objPreviewTxt');
     objSelectedTxt = document.getElementById('objSelectedTxt');
     objGlobal = document.getElementById('tblGlobal');
     objGray = document.getElementById('tblGray');
     objSafe = document.getElementById('tblSafe');
     objSys = document.getElementById('tblSys');
     objName = document.getElementById('tblName');
     objLegend = document.getElementById('objLegend');
     fctSelect('Name', 'Named');
    }
     
    objSB.Append('<table id="tblGlobal" class="tblGlobal" border="0" cellpadding="0" cellspacing="0"><tr><td class="tdContainer"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>');
    objSB.Append('<td width="24%" align="center"><input type="button" value="Named" class="btnPalette" onClick="fctSelect(\'Name\', \'Named\');"></td>');
    objSB.Append('<td width="23%" align="center"><input type="button" value="Safety" class="btnPalette" onClick="fctSelect(\'Safe\', \'Safety\');"></td>');
    objSB.Append('<td width="23%" align="center"><input type="button" value="System" class="btnPalette" onClick="fctSelect(\'Sys\', \'System\');"></td>');
    objSB.Append('<td width="30%" align="center"><input type="button" value="Grayscale" class="btnPalette" onClick="fctSelect(\'Gray\', \'Grayscale\');"></td>');
    objSB.Append('</tr></table></td></tr><tr><td class="tdContainer"><fieldset><legend align="top" id="objLegend"></legend><table id="tblContainer" class="tblContainer" border="0" cellpadding="0" cellspacing="0"><tr><td class="tdContainer">');
     
    objSB.Append('<table id="tblGray" class="tblColor" border="0" cellpadding="0" cellspacing="0"><tr>');
    for (i = 0; i < arrGray.length; i++) {
     for (j = 0; j < arrGray.length; j++) {
      strColor = '' + arrGray[i] + arrGray[j] + arrGray[i] + arrGray[j] + arrGray[i] + arrGray[j];
      strColorTxt = '' + fctIsInName(strColor);
      if (strColorTxt == '') {strColorTxt = '' + fctIsInSys(strColor);}
      objSB.Append('<td class="tdColor"><a class="color" href="javascript:fctSetColor(\'#' + strColor + '\', \'' + strColorTxt + '\');" style="background-color:#' + strColor + ';" onMouseOver="fctOver(\'#' + strColor + '\', \'' + strColorTxt + '\');" onMouseOut="fctOut();">&nbsp;</a></td>');
      intTdDisp++;
      intTblDisp++;
     }
     if (i < arrGray.length - 1) {
      objSB.Append('</tr><tr>');
      intTdDisp = 0;
     }
    }
    fctTblFeed();
    objSB.Append('</tr></table>');
    intTdDisp = intTblDisp = 0;
     
    objSB.Append('<table id="tblSafe" class="tblColor" border="0" cellpadding="0" cellspacing="0"><tr>');
    for (i = 0; i < arrSafe.length; i++) {
     for (j = 0; j < arrSafe.length; j++) {
      for (k = 0; k < arrSafe.length; k++) {
       if (intTblDisp % 16 == 0 && intTdDisp != 0) {
        objSB.Append('</tr><tr>');
        intTdDisp = 0;
       }
       strColor = '' + arrSafe[i] + arrSafe[j] + arrSafe[k];
       strColorTxt = '' + fctIsInName(strColor);
       if (strColorTxt == '') {strColorTxt = '' + fctIsInSys(strColor);}
       objSB.Append('<td class="tdColor"><a class="color" href="javascript:fctSetColor(\'#' + strColor + '\', \'' + strColorTxt + '\');" style="background-color:#' + strColor + ';" onMouseOver="fctOver(\'#' + strColor + '\', \'' + strColorTxt + '\');" onMouseOut="fctOut();">&nbsp;</a></td>');
       intTdDisp++;
       intTblDisp++;
      }
     }
    }
    fctTblFeed();
    objSB.Append('</tr></table>');
    intTdDisp = intTblDisp = 0;
     
    objSB.Append('<table id="tblSys" class="tblColor" border="0" cellpadding="0" cellspacing="0"><tr>');
    for (i = 0; i < arrSys.length; i++) {
     if (intTblDisp % 16 == 0 && intTdDisp != 0) {
      objSB.Append('</tr><tr>');
      intTdDisp = 0;
     }
     strColor = '' + arrSys[i][0];
     strColorTxt = '' + arrSys[i][1];
     objSB.Append('<td class="tdColor"><a class="color" href="javascript:fctSetColor(\'#' + strColor + '\', \'' + strColorTxt + '\');" style="background-color:#' + strColor + ';" onMouseOver="fctOver(\'#' + strColor + '\', \'' + strColorTxt + '\');" onMouseOut="fctOut();">&nbsp;</a></td>');
     intTdDisp++;
     intTblDisp++;
    }
    fctTblFeed();
    objSB.Append('</tr></table>');
    intTdDisp = intTblDisp = 0;
     
    objSB.Append('<table id="tblName" class="tblColor" border="0" cellpadding="0" cellspacing="0"><tr>');
    for (i = 0; i < arrName.length; i++) {
     if (intTblDisp % 16 == 0 && intTdDisp != 0) {
      objSB.Append('</tr><tr>');
      intTdDisp = 0;
     }
     strColor = '' + arrName[i][0];
     strColorTxt = '' + arrName[i][1];
     objSB.Append('<td class="tdColor"><a class="color" href="javascript:fctSetColor(\'#' + strColor + '\', \'' + strColorTxt + '\');" style="background-color:#' + strColor + ';" onMouseOver="fctOver(\'#' + strColor + '\', \'' + strColorTxt + '\');" onMouseOut="fctOut();">&nbsp;</a></td>');
     intTdDisp++;
     intTblDisp++;
    }
    fctTblFeed();
    objSB.Append('</tr></table></td></tr></table></fieldset></td></tr><tr><td class="tdContainer">');
    objSB.Append('<table border="0" cellpadding="0" cellspacing="0" width="100%">');
    objSB.Append('<tr><td class="tdDisplay" id="objPreview">&nbsp;</td><td class="tdDisplay" id="objSelected">&nbsp;</td></tr>');
    objSB.Append('<tr><td class="tdDisplayTxt" id="objPreviewTxt" valign="top">&nbsp;</td><td class="tdDisplayTxt" id="objSelectedTxt" valign="top">&nbsp;</td></tr>');
    objSB.Append('</table></td></tr><tr><td class="tdContainer">');
    objSB.Append('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>');
    objSB.Append('<td width="33%" align="center"><input type="button" value="Cancel" class="btnColor" onClick="fctHide();"></td>');
    objSB.Append('<td width="34%" align="center"><input type="button" value="Reset" class="btnColor" onClick="fctReset();"></td>');
    objSB.Append('<td width="33%" align="center"><input type="button" value="Ok" class="btnColor" onClick="fctOk();"></td>');
    objSB.Append('</tr></table></td></tr></table>');
    </script>
    <script type="text/javascript">
    window.onload = function()
    {
     fctLoad();
    }
    window.onscroll = function()
    {
     fctShow();
    }
    window.onresize = function()
    {
     fctShow();
    }
    </script>
    </head>
     
    <body>
    <form name="objForm" method="post action="?">
    <input type="text" size="10" name="color" value="" maxlength="7" style="font-family:Tahoma;font-size:x-small;" onchange="document.getElementById('exemple').style.color=document.getElementsByName('color')[0].value;">
    <img src="http://kilian67.free.fr/Img/color.gif" width="21" height="20" border="0" align="absmiddle" style="cursor:pointer;" onClick="fctShow(document.objForm.color);">
    <br>
    </form>
    <table border="2" align="center" width="30%" bordercolor="#999999" bordercolordark="#666666" bordercolorlight="#CCCCCC">
                                                <tr>
                                                    <td width="100%" align="center" valign="middle" id="exemple">
     
                                                        <p>Exemple d'affichage</p>
                                                    </td>
                                                </tr>
                                            </table>
    </body>
    </html>
    encore


    Avant de poster faites une recherche et/ou consultez la FAQ.

    Un sujet est résolu n'oubliez pas le tag

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Animation qui ne fonctionne pas avec FireFox
    Par jpboogie dans le forum ActionScript 1 & ActionScript 2
    Réponses: 2
    Dernier message: 25/02/2009, 13h36
  2. Dégradé en CSS ne fonctionne pas avec firefox
    Par mullger dans le forum Mise en page CSS
    Réponses: 7
    Dernier message: 12/12/2006, 10h42
  3. ligne-height ne fonctionne pas avec firefox?
    Par 12monkeys dans le forum Mise en page CSS
    Réponses: 14
    Dernier message: 28/11/2006, 09h01
  4. Evenement OnClick qui ne fonctionne pas sous firefox
    Par frechy dans le forum Général JavaScript
    Réponses: 6
    Dernier message: 27/12/2005, 16h06
  5. window.resizeTo ne fonctionne pas avec firefox?
    Par FrankOVD dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 28/06/2005, 15h07

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