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 :

return ne retourne rien et plante le reste du code


Sujet :

JavaScript

  1. #1
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    Par défaut return ne retourne rien et plante le reste du code
    Bonjour a tous

    et voila un nouveau soucis que je ne comprends pas peut être la syntaxe n'est pas bonne

    j'ai une fonction qui au move du canvas me donne la couleur ca c'est OK
    par contre avant je faisait ce que j'avais a faire avec la couleur a l’intérieur de la fonction
    je préférerais que la fonction me retourne la couleur a son apel pour la manipuler dans une autre fonction si possible sans variable globale

    je parel donc du return
    mais visible ment ca plante le code
    voici la fonction
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     function getpixelcolor(e) {
     
                   var Kanvas = document.getElementById("palcouleur")
                    var rect = Kanvas.getBoundingClientRect();
                    X = (e.pageX - rect.left);
                   Y = e.pageY - rect.top;
                    var ctx = Kanvas.getContext('2d');
                   var c = ctx.getImageData(Math.round(X), Math.round(Y), 1, 1).data;
                    var hex = "#" + ("000000" + rgbToHex(c[0], c[1], c[2])).slice(-6);
                    // return  "#" + ("000000" + rgbToHex(c[0], c[1], c[2])).slice(-6);
    // alert("ccc");
                }
    quelqu'un a une idée
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  2. #2
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    Essaie ça.

    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
     
    <!DOCTYPE HTML >
    <html lang="fr">
    <head>
        <!--meta charset="utf-8"-->
        <title>patrick WYSIWYG html </title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <script>
      function draw() {
       document.getElementById('palcouleur').addEventListener("mousemove" ,displayPixelColor,false);
       var maxlarge=document.getElementById('palcouleur').offsetWidth;
       var maxheight=document.getElementById('palcouleur').offsetHeight;
       var ctx = document.getElementById('palcouleur').getContext('2d');
       var gradient = ctx.createLinearGradient(0,0,maxlarge,0);///vertical
       gradient.addColorStop(0,"black");     // Départ
       gradient.addColorStop(0.2,"rgb(255,100,100)"); // Intermédiaire
       gradient.addColorStop(0.3,"blue");    // Intermédiaire
       gradient.addColorStop(0.4,"magenta"); // Intermédiaire
       gradient.addColorStop(0.5,"rgb(0,100,255)");    // Intermédiaire
       gradient.addColorStop(0.6,"green");    // Intermédiaire
       gradient.addColorStop(0.8,"yellow");    // Intermédiaire
       gradient.addColorStop(1,"red");    // Arrivée
       ctx.fillStyle = gradient;            // Affectation au remplissage
       ctx.fillRect(0,0,300,150);
      }   
     
      function getMouseCoords(e) {
                coords = new Array();
       var Kanvas = document.getElementById('palcouleur')
                var rect = Kanvas.getBoundingClientRect();  
                X = (e.pageX - rect.left);
                Y = e.pageY - rect.top; 
       coords['X'] = X;
       coords['Y'] = Y;
       return coords;
      }
     
      function displayPixelColor(e) {
       document.getElementById("results").style.backgroundColor = getpixelcolor(e);
       coords = getMouseCoords(e);
       document.getElementById("results").innerText = "left : " + Math.round(coords['X']) + "  top : " + Math.round(coords['Y']);
      }
     
            function getpixelcolor(e) {
                var Kanvas = document.getElementById('palcouleur')
       coords = getMouseCoords(e);
                X = coords['X'];
                Y = coords['Y'];
                var ctx = Kanvas.getContext('2d');
                var c = ctx.getImageData(Math.round(X), Math.round(Y), 1, 1).data;
                var hex = "#" + ("000000" + rgbToHex(c[0], c[1], c[2])).slice(-6);
       return hex;
            }  
     
            function rgbToHex(r, g, b) {
                if (r > 255 || g > 255 || b > 255)
                    throw "Invalid color component";
                return ((r << 16) | (g << 8) | b).toString(16);
            }
     
        </script>
    </head>
    <body>
        <canvas id="palcouleur" style="width:300px;height:150px;border:1px solid black;"></canvas>
        <BUTTON id="results" style="position:absolute;top:200px;left:2px;width:200px;height:40px;"></BUTTON>
        <script>
      document.getElementById("palcouleur").addEventListener("mousedown", function() {   
      document.getElementById("palcouleur").className = "mov" ;     
            alert("cc");//le message n'apparait pas donc ca plante avant 
            //this.parentElement.style.visibility = "hidden";
            });
     
            document.getElementById("palcouleur").addEventListener("mouseup", function() {
     
     
               //this.parentElement.style.visibility = "hidden";
            });
            draw();
        </script>
    </body>
    </html>
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  3. #3
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    Par défaut re
    re
    bonjour badaze
    et oui mais j'ai deux palette a faire fonctionner avec les même fonctions
    comme je n'arrive pas a me retourner le pixel j'agit directement dans la fonction getpixel
    et la il se passe un truc complément illogique
    selon la palette je modifie la classe et l'attribut couleur pour palette et couleur2 pour palette2
    si tu regarde bien la capture a droite dans l'inspecteur de document on vois bien que ca change sauf que les attribut sont affecter aux deux alors que chacun devrait avoir le sien un truc de fou
    normalement l'une devrait changer la ouleur du fond et l'autre la bordure
    voila le code complet
    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
    <!DOCTYPE HTML >
    <html lang="fr">
    <head>
        <!--meta charset="utf-8"-->
        <title>patrick WYSIWYG html </title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <head>
            <!--meta charset="utf-8"-->
            <title>patrick WYSIWYG html </title>
            <meta http-equiv="X-UA-Compatible" content="IE=11">
     
            <style>
                .slideImpRa {
                    margin: 0;
                    margin-top: -35px;
                    width: 300px;
                    vertical-align: middle;
                }
     
                .slide {
                    width: 150px;
                } //border:1px solid gray;
                #.labslide {
                    width: 260px;
                }
     
                #one {
                    margin-top: 0;
                }
     
                .selects2 {
                    border: 1px solid white;
                    background-color: #9AB9C3;
                    position: relative;
                    z-index: 100;
                    width: 150px;
                    font-size: 15px;
                }
     
                .menusup {
                    position: relative;
                    border: 1px solid #607F94;
                    z-index: 100;
                    background-color: #ACC3CB;
                    border-radius: 5px;
                }
     
                .rad {
                    color: #086A87;
                    border-radius: 4px;
                    BORDER-TOP: #607f94 0.1pt solid;
                    HEIGHT: 100%;
                    BORDER-RIGHT: #607f94 0.1pt solid;
                    WIDTH: 100%;
                    BORDER-BOTTOM: #607f94 0.1pt solid;
                    BORDER-LEFT: #607f94 0.1pt solid;
                    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(149, 171, 185, 0.65) 69%);
                }
     
                .rad:hover {
                    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(66, 137, 178, 0.65) 69%);
                    color: white;
                }
     
                .btclose {
                    width20px;
                    height: 20px;
                    background-color: gray;
                    color: red;
                    float: right;
                    margin: 2px;
                }
     
                .btclose:hover {
                    background-color: red;
                    color: gray;
                }
            </style>
            <script>
                var actifelem
                var oldmenu;
                var modepal;
                function draw(elempalid) {
                    var maxlarge = document.getElementById(elempalid).offsetWidth;
                    var maxheight = document.getElementById(elempalid).offsetHeight;
                    document.getElementById(elempalid).setAttribute('width', maxlarge);
                    document.getElementById(elempalid).setAttribute('height', maxheight)
                    var ctx = document.getElementById(elempalid).getContext('2d');
                    var gradient = ctx.createLinearGradient(0, 0, maxlarge, 0); ///vertical
                    //var gradient = ctx.createLinearGradient(0,0,0,maxheight);//horizontal
                    //var gradient = ctx.createLinearGradient(0,0,maxlarge,maxheight);//vertical oblique
                    gradient.addColorStop(0, "white"); // Départ
                    gradient.addColorStop(0.1, "black"); // Départ
                    gradient.addColorStop(0.2, "rgb(255,100,100)"); // Intermédiaire
                    gradient.addColorStop(0.3, "blue"); // Intermédiaire
                    gradient.addColorStop(0.4, "magenta"); // Intermédiaire
                    gradient.addColorStop(0.43, "rgb(255,150,255)"); // Intermédiaire
                    gradient.addColorStop(0.47, "magenta"); // Intermédiaire
                    gradient.addColorStop(0.5, "rgb(0,100,255)"); // Intermédiaire
                    gradient.addColorStop(0.52, "rgb(0,100,255)"); // Intermédiaire
                    gradient.addColorStop(0.53, "rgb(0,150,255)"); // Intermédiaire
                    gradient.addColorStop(0.55, "rgb(0,200,255)"); // Intermédiaire
                    gradient.addColorStop(0.58, "rgb(0,200,255)"); // Intermédiaire
                    gradient.addColorStop(0.6, "green"); // Intermédiaire
                    gradient.addColorStop(0.8, "yellow"); // Intermédiaire
                    gradient.addColorStop(1, "red"); // Arrivée
                    ctx.fillStyle = gradient; // Affectation au remplissage
                    ctx.fillRect(0, 0, maxlarge, maxheight);
                }
                function getpixelcolor(e) {
                    //alert(event);
                    var Kanvas = document.getElementById(event.target.id)
                    var rect = Kanvas.getBoundingClientRect();
                    X = (e.pageX - rect.left);
                    Y = e.pageY - rect.top;
                    var ctx = Kanvas.getContext('2d');
                    var c = ctx.getImageData(Math.round(X), Math.round(Y), 1, 1).data;
                    var hex = "#" + ("000000" + rgbToHex(c[0], c[1], c[2])).slice(-6);
                    if (e.target.id == "palcouleur"); {
                        if (e.target.className == "mov") {
                            actifelem.style.backgroundColor = hex;
                            e.target.setAttribute("couleur", hex);
                        }
                    }
                    if (e.target.id == "palcouleur2"); {
                        if (e.target.className == "mov") {
                            actifelem.style.borderColor = hex;
                            e.target.setAttribute("couleur2", hex);
                        }
                    }
                }
                function rgbToHex(r, g, b) {
                    if (r > 255 || g > 255 || b > 255)
                        throw "Invalid color component";
                    return ((r << 16) | (g << 8) | b).toString(16);
                }
     
                function initbout() {
                    draw("palcouleur");
                    draw("palcouleur2");
                    actifelem = document.getElementById("divtest");
                    document.getElementById('palcouleur').addEventListener("mousemove", getpixelcolor, false);
                    document.getElementById("palcouleur").addEventListener("mousedown", function() {
                        this.className = "mov";
                    });
                    document.getElementById("palcouleur").addEventListener("mouseup", function() {
                        this.className = "nomov";
                    });
                    document.getElementById('palcouleur2').addEventListener("mousemove", getpixelcolor, false);
                    document.getElementById("palcouleur2").addEventListener("mousedown", function() {
                        this.className = "mov";
                    });
                    document.getElementById("palcouleur2").addEventListener("mouseup", function() {
                        this.className = "nomov";
                    });
     
                    document.getElementById("bordercolor").addEventListener("click", function() {
                        modepal = "bordercolor";
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menupal");
                        oldmenu.style.visibility = "visible";
                    });
                    document.getElementById("backcouleurdiv").addEventListener("click", function() {
                        modepal = "backgrounddiv";
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menupal");
                        oldmenu.style.visibility = "visible";
                    });
     
                    ////////////////////////////////////////////////////////////////////////////////////////////////evenement menu coin 
                    document.getElementById("coin").addEventListener("click", function() {
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menucoin");
                        oldmenu.style.visibility = "visible";
                    });
                    document.getElementById("slidebordhg").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderTopLeftRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordhd").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderTopRightRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordbg").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderBottomLeftRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordbd").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderBottomRightRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordfour").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderRadius = this.value + "%";
                        };
                    });
                    ///////////////////////////////////////////////////////////////////////////////////////////////////fin du menu coin
     
                    document.getElementById("borderwidth").addEventListener("click", function() {
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menuborderwidth");
                        oldmenu.style.visibility = "visible";
                        oldmenu.zIndex = 100;
                        document.getElementById("slidebordwidth").value = Math.round(actifelem.style.borderWidth.replace("px", ""));
                    });
                    document.getElementById("slidebordwidth").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderWidth = this.value + "px";
                        };
                    });
     
     
                }
            </script>
        </head>
        <body>
            <div id="menudiv" class="menusup" style="width:470px;height:220px;  ">
                <button class="btclose">X</button>
                <div class="selects2" id="mmenuaction" style="position:absolute; left:10px;top:10px;width:120px;height:185px;">
                    <button class="rad" id="ajoutdiv" style="height:30px;">Ajouter un div</button>
                    <button class="rad" id="coin" style="height:30px;">Arrondi des coins</button>
                    <button class="rad" id="borderwidth" style="height:30px;">BorderWidth</button>
                    <button class="rad" id="bordercolor" style="height:30px;">Bordercolor</button>
                    <button class="rad" id="backcouleurdiv" style="height:30px;">Background Color</button>
                    <button class="rad" id="backgroundgradient" style="height:30px;">Bacground gtadient</button>
                </div>
                <!------------------------------------------->
                <div class="selects2" id="menucoin" style="position:absolute; width:300px;height:150px;left: 160px;top:30px;margin-right:1px; visibility:visible ; ">
                    <p class="slideImpRa" id=o ne>
                        <label class="labslide" for="slidebordhg">coin Haut Gauche :</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordhg">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordhd">coin Haut droite :&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordhd">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordbg">coin Bas  Gauche :&nbsp;&nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordbg">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordbd">coin Bas  Droite  :&nbsp;&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordbd">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordfour">les quate angles :&nbsp;&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="50" id="slidebordfour">
                    </p>
                </div>
                <!------------------------------------------->
                <div class="selects2" id="menupal" style="position:absolute; width:300px;height:150px;left: 160px;top:30px;margin-right:1px;visibility:hidden ; ">
                    <canvas id="palcouleur" style="margin-left:10px;width:130px;height:75px;border:1px solid red;"></canvas>
                    <canvas id="palcouleur2" style="margin-left:10px;width:130px;height:75px;border:1px solid red;"></canvas>
                </div>
                <!------------------------------------------->
                <div class="selects2" id="menuborderwidth" style="position:absolute; width:300px;height:150px;left: 160px;top:30px;margin-right:1px;visibility:hidden ; ">
                    <p> Modifier l'épaisseur des bordures du div actif</p>
                    <p style="margin-top:10px;">
                        <input type="range" min="0" max="50" id="slidebordwidth">
                    </p>
                </div>
                <!------------------------------------------->
            </div>
            <div id="divtest" style="border: 15px solid red;position:absolute;left:50px;top:250px;width:400px;height:300px;"></div>
            <script>
                initbout();
            </script>
        </body>
    </html>
    Nom : demo2.gif
Affichages : 190
Taille : 1,28 Mo
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  4. #4
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    En fait tu peux tout faire avec une seule palette. Le contexte te permettant d'affecter le bon attribut.

    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
     
    <!DOCTYPE HTML >
    <html lang="fr">
    <head>
        <!--meta charset="utf-8"-->
        <title>patrick WYSIWYG html </title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <!--meta charset="utf-8"-->
            <title>patrick WYSIWYG html </title>
            <meta http-equiv="X-UA-Compatible" content="IE=11">
     
            <style>
                .slideImpRa {
                    margin: 0;
                    margin-top: -35px;
                    width: 300px;
                    vertical-align: middle;
                }
     
                .slide {
                    width: 150px;
                } //border:1px solid gray;
                #.labslide {
                    width: 260px;
                }
     
                #one {
                    margin-top: 0;
                }
     
                .selects2 {
                    border: 1px solid white;
                    background-color: #9AB9C3;
                    position: relative;
                    z-index: 100;
                    width: 150px;
                    font-size: 15px;
                }
     
                .menusup {
                    position: relative;
                    border: 1px solid #607F94;
                    z-index: 100;
                    background-color: #ACC3CB;
                    border-radius: 5px;
                }
     
                .rad {
                    color: #086A87;
                    border-radius: 4px;
                    BORDER-TOP: #607f94 0.1pt solid;
                    HEIGHT: 100%;
                    BORDER-RIGHT: #607f94 0.1pt solid;
                    WIDTH: 100%;
                    BORDER-BOTTOM: #607f94 0.1pt solid;
                    BORDER-LEFT: #607f94 0.1pt solid;
                    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(149, 171, 185, 0.65) 69%);
                }
     
                .rad:hover {
                    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(66, 137, 178, 0.65) 69%);
                    color: white;
                }
     
                .btclose {
                    width20px;
                    height: 20px;
                    background-color: gray;
                    color: red;
                    float: right;
                    margin: 2px;
                }
     
                .btclose:hover {
                    background-color: red;
                    color: gray;
                }
            </style>
            <script>
                var actifelem
                var oldmenu;
                var modepal;
                function draw(elempalid) {
                    var maxlarge = document.getElementById(elempalid).offsetWidth;
                    var maxheight = document.getElementById(elempalid).offsetHeight;
                    document.getElementById(elempalid).setAttribute('width', maxlarge);
                    document.getElementById(elempalid).setAttribute('height', maxheight)
                    var ctx = document.getElementById(elempalid).getContext('2d');
                    var gradient = ctx.createLinearGradient(0, 0, maxlarge, 0); ///vertical
                    //var gradient = ctx.createLinearGradient(0,0,0,maxheight);//horizontal
                    //var gradient = ctx.createLinearGradient(0,0,maxlarge,maxheight);//vertical oblique
                    gradient.addColorStop(0, "white"); // Départ
                    gradient.addColorStop(0.1, "black"); // Départ
                    gradient.addColorStop(0.2, "rgb(255,100,100)"); // Intermédiaire
                    gradient.addColorStop(0.3, "blue"); // Intermédiaire
                    gradient.addColorStop(0.4, "magenta"); // Intermédiaire
                    gradient.addColorStop(0.43, "rgb(255,150,255)"); // Intermédiaire
                    gradient.addColorStop(0.47, "magenta"); // Intermédiaire
                    gradient.addColorStop(0.5, "rgb(0,100,255)"); // Intermédiaire
                    gradient.addColorStop(0.52, "rgb(0,100,255)"); // Intermédiaire
                    gradient.addColorStop(0.53, "rgb(0,150,255)"); // Intermédiaire
                    gradient.addColorStop(0.55, "rgb(0,200,255)"); // Intermédiaire
                    gradient.addColorStop(0.58, "rgb(0,200,255)"); // Intermédiaire
                    gradient.addColorStop(0.6, "green"); // Intermédiaire
                    gradient.addColorStop(0.8, "yellow"); // Intermédiaire
                    gradient.addColorStop(1, "red"); // Arrivée
                    ctx.fillStyle = gradient; // Affectation au remplissage
                    ctx.fillRect(0, 0, maxlarge, maxheight);
                }
                function getpixelcolor(e) {
     
                    var Kanvas = document.getElementById(event.target.id)
                    var rect = Kanvas.getBoundingClientRect();
                    X = (e.pageX - rect.left);
                    Y = e.pageY - rect.top;
                    var ctx = Kanvas.getContext('2d');
                    var c = ctx.getImageData(Math.round(X), Math.round(Y), 1, 1).data;
                    var hex = "#" + ("000000" + rgbToHex(c[0], c[1], c[2])).slice(-6);
                    if (e.target.id == "palcouleur"); {
         if (modepal == "bordercolor") {     
                            actifelem.style.borderColor = hex;
                            e.target.setAttribute("couleur2", hex);
          return;     
         }
     
         if (modepal == "backgrounddiv") {      
                            actifelem.style.backgroundColor = hex;
                            e.target.setAttribute("couleur", hex);
          return;
         }
                    }
                }
                function rgbToHex(r, g, b) {
                    if (r > 255 || g > 255 || b > 255)
                        throw "Invalid color component";
                    return ((r << 16) | (g << 8) | b).toString(16);
                }
     
                function initbout() {
                    draw("palcouleur");
                    //draw("palcouleur2");
                    actifelem = document.getElementById("divtest");
                    document.getElementById('palcouleur').addEventListener("mousemove", getpixelcolor, false);
                    document.getElementById("palcouleur").addEventListener("mousedown", function() {
                        this.className = "mov";
                    });
                    document.getElementById("palcouleur").addEventListener("mouseup", function() {
                        this.className = "nomov";
                    });
                    document.getElementById('palcouleur2').addEventListener("mousemove", getpixelcolor, false);
                    document.getElementById("palcouleur2").addEventListener("mousedown", function() {
                        this.className = "mov";
                    });
                    document.getElementById("palcouleur2").addEventListener("mouseup", function() {
                        this.className = "nomov";
                    });
     
                    document.getElementById("bordercolor").addEventListener("click", function() {
                        modepal = "bordercolor";
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menupal");
                        oldmenu.style.visibility = "visible";
                    });
                    document.getElementById("backcouleurdiv").addEventListener("click", function() {
                        modepal = "backgrounddiv";
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menupal");
                        oldmenu.style.visibility = "visible";
                    });
     
                    ////////////////////////////////////////////////////////////////////////////////////////////////evenement menu coin 
                    document.getElementById("coin").addEventListener("click", function() {
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menucoin");
                        oldmenu.style.visibility = "visible";
                    });
                    document.getElementById("slidebordhg").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderTopLeftRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordhd").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderTopRightRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordbg").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderBottomLeftRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordbd").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderBottomRightRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordfour").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderRadius = this.value + "%";
                        };
                    });
                    ///////////////////////////////////////////////////////////////////////////////////////////////////fin du menu coin
     
                    document.getElementById("borderwidth").addEventListener("click", function() {
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menuborderwidth");
                        oldmenu.style.visibility = "visible";
                        oldmenu.zIndex = 100;
                        document.getElementById("slidebordwidth").value = Math.round(actifelem.style.borderWidth.replace("px", ""));
                    });
                    document.getElementById("slidebordwidth").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderWidth = this.value + "px";
                        };
                    });
     
     
                }
            </script>
        </head>
        <body>
            <div id="menudiv" class="menusup" style="width:470px;height:220px;  ">
                <button class="btclose">X</button>
                <div class="selects2" id="mmenuaction" style="position:absolute; left:10px;top:10px;width:120px;height:185px;">
                    <button class="rad" id="ajoutdiv" style="height:30px;">Ajouter un div</button>
                    <button class="rad" id="coin" style="height:30px;">Arrondi des coins</button>
                    <button class="rad" id="borderwidth" style="height:30px;">BorderWidth</button>
                    <button class="rad" id="bordercolor" style="height:30px;">Bordercolor</button>
                    <button class="rad" id="backcouleurdiv" style="height:30px;">Background Color</button>
                    <button class="rad" id="backgroundgradient" style="height:30px;">Bacground gtadient</button>
                </div>
     
                <div class="selects2" id="menucoin" style="position:absolute; width:300px;height:150px;left: 160px;top:30px;margin-right:1px; visibility:visible ; ">
                    <p class="slideImpRa" id=o ne>
                        <label class="labslide" for="slidebordhg">coin Haut Gauche :</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordhg">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordhd">coin Haut droite :&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordhd">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordbg">coin Bas  Gauche :&nbsp;&nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordbg">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordbd">coin Bas  Droite  :&nbsp;&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordbd">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordfour">les quate angles :&nbsp;&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="50" id="slidebordfour">
                    </p>
                </div>
                 <div class="selects2" id="menupal" style="position:absolute; width:300px;height:150px;left: 160px;top:30px;margin-right:1px;visibility:hidden ; ">
                    <canvas id="palcouleur" style="margin-left:10px;width:130px;height:75px;border:1px solid red;"></canvas>
                    <canvas id="palcouleur2" style="margin-left:10px;width:130px;height:75px;border:1px solid red;"></canvas>
                </div>
                <div class="selects2" id="menuborderwidth" style="position:absolute; width:300px;height:150px;left: 160px;top:30px;margin-right:1px;visibility:hidden ; ">
                    <p> Modifier l'épaisseur des bordures du div actif</p>
                    <p style="margin-top:10px;">
                        <input type="range" min="0" max="50" id="slidebordwidth">
                    </p>
                </div>
            </div>
            <div id="divtest" style="border: 15px solid red;position:absolute;left:50px;top:250px;width:400px;height:300px;">&nbsp;</div>
            <script>
                initbout();
            </script>
      <div id="trace"></div>
        </body>
    </html>
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  5. #5
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    Par défaut re
    re
    a oui mince j'aurais pas du tout te mettre ca t a induit en erreur
    non je ne peut pas comme ca car:
    j'ai comme cahier des charges

    1.backgroundcolor
    gradient
    couleur pleine
    2.bordercolor
    gradient
    couleur pleine

    autrement dis j'ai 4 paramètres
    deux palette étant le moyen le plus facile d'y arriver sinon je vais devoir coder comme un malade
    la palette1 étant la couleur pleine la 2 étant la couleur du gradient combiné avec la couleur 1

    de toute façon ma méthode n'était pas bonne
    en fait les attributs il faut les donner au "actifelem" de façon a que si je reviens dessus je puisse changer soit la couleur 1 ou 2 sachant que actifelem sera le div sélectionné(actif) dans mon wysiwyg et je doit donc pouvoir partir sur un autre div et revenir dessus sans perdre ses couleurs
    de facon a que si je retouche la palette2 je ne modifie que la couleur2 et pareil pour la 1
    je vais donc revoir cela et reviens avec le bon

    je sais pas si je me suis fait comprendre
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  6. #6
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    Par défaut re
    re
    un truc qui me rend dingue au point de tout casser c'est le fait que e ou event.target.id me donne bien la bonne palette dans un msgbox(alert)
    et que var Kanvas = document.getElementById(e.target.id)me donne bien la bonne palette puisque la fonction marcheet en bout de fonction si je fait
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     if (kanvas.className=="mov"){actifelem.style.backgroundColor=hex;actifelem.setAttribute("couleur",hex);}
    ca me donne dans le log kanvas indefini !!!!!!!!!!!

    je vais tout casser
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  7. #7
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    Tu as essayé le code que j'ai posté ?
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  8. #8
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    Citation Envoyé par patricktoulon Voir le message
    re
    un truc qui me rend dingue au point de tout casser c'est le fait que e ou event.target.id me donne bien la bonne palette dans un msgbox(alert)
    et que var Kanvas = document.getElementById(e.target.id)me donne bien la bonne palette puisque la fonction marcheet en bout de fonction si je fait
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     if (kanvas.className=="mov"){actifelem.style.backgroundColor=hex;actifelem.setAttribute("couleur",hex);}
    ca me donne dans le log kanvas indefini !!!!!!!!!!!

    je vais tout casser
    Kanvas et non pas kanvas.
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  9. #9
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    Par défaut re
    re
    a oui mince ca fatigue de mon coté hein!!!
    bon ben finalement j'y suis arriver déjà pour le background color ou backgroundgradient
    on peut revenir et repartir comme on veut
    je vais rajouter des bouton pour le sens et un slide pour le pourcentage
    tu veux le code ?
    Nom : demo2.gif
Affichages : 194
Taille : 651,1 Ko
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  10. #10
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    Ca m'intéresse.
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  11. #11
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  12. #12
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    Premières choses.

    Pour que ça fonctionne chez moi (IE11) j'ai dû modifier les lignes qui contiennent e.target.className == "mov"

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    avant : if (e.target.id == "palcouleur" && e.target.className == "mov" && modepal == "bordercolor") {
    après : if (e.target.id == "palcouleur" && modepal == "bordercolor") {
    Si je modifie le bord ou l'intérieur.
    - La palette de gauche donne des couleurs pleines, celle de droite du dégradé mais si je reviens sur celle de gauche j'ai des couleurs dégradées.


    <!-------------------------------------------> me donne un message d'erreur dans la console. => Caractère inattendu : U+002D TRAIT D’UNION/SIGNE MOINS (-)

    Est-ce que tu as prévu une action (un clic ou un double clic) pour fixer la couleur choisie ?
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  13. #13
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    Pour le fun uniquement car je ne pense pas que ce soit ce que tu veux car je triche. Par contre on peut faire des effets sympas.

    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
     
    <!DOCTYPE HTML >
    <html lang="fr">
    <head>
        <!--meta charset="utf-8"-->
        <title>patrick WYSIWYG html </title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <head>
            <!--meta charset="utf-8"-->
            <title>patrick WYSIWYG html </title>
            <meta http-equiv="X-UA-Compatible" content="IE=11">
     
            <style>
                .slideImpRa {
                    margin: 0;
                    margin-top: -35px;
                    width: 300px;
                    vertical-align: middle;
                }
     
                .slide {
                    width: 150px;
                } //border:1px solid gray;
                #.labslide {
                    width: 260px;
                }
     
                #one {
                    margin-top: 0;
                }
     
                .selects2 {
                    border: 1px solid white;
                    background-color: #9AB9C3;
                    position: relative;
                    z-index: 100;
                    width: 150px;
                    font-size: 15px;
                }
     
                .menusup {
                    position: relative;
                    border: 1px solid #607F94;
                    z-index: 100;
                    background-color: #ACC3CB;
                    border-radius: 5px;
                }
     
                .rad {
                    color: #086A87;
                    border-radius: 4px;
                    BORDER-TOP: #607f94 0.1pt solid;
                    HEIGHT: 100%;
                    BORDER-RIGHT: #607f94 0.1pt solid;
                    WIDTH: 100%;
                    BORDER-BOTTOM: #607f94 0.1pt solid;
                    BORDER-LEFT: #607f94 0.1pt solid;
                    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(149, 171, 185, 0.65) 69%);
                }
     
                .rad:hover {
                    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(66, 137, 178, 0.65) 69%);
                    color: white;
                }
     
                .btclose {
                    width20px;
                    height: 20px;
                    background-color: gray;
                    color: red;
                    float: right;
                    margin: 2px;
                }
     
                .btclose:hover {
                    background-color: red;
                    color: gray;
                }
            </style>
            <script>
                var actifelem
       var actifelem2
                var oldmenu;
                var modepal;
                function draw(elempalid) {
                    var maxlarge = document.getElementById(elempalid).offsetWidth;
                    var maxheight = document.getElementById(elempalid).offsetHeight;
                    document.getElementById(elempalid).setAttribute('width', maxlarge);
                    document.getElementById(elempalid).setAttribute('height', maxheight)
                    var ctx = document.getElementById(elempalid).getContext('2d');
                    var gradient = ctx.createLinearGradient(0, 0, maxlarge, 0); ///vertical
                    //var gradient = ctx.createLinearGradient(0,0,0,maxheight);//horizontal
                    //var gradient = ctx.createLinearGradient(0,0,maxlarge,maxheight);//vertical oblique
                    gradient.addColorStop(0, "white"); // Départ
                    gradient.addColorStop(0.1, "black"); // Départ
                    gradient.addColorStop(0.2, "rgb(255,100,100)"); // Intermédiaire
                    gradient.addColorStop(0.3, "blue"); // Intermédiaire
                    gradient.addColorStop(0.4, "magenta"); // Intermédiaire
                    gradient.addColorStop(0.43, "rgb(255,150,255)"); // Intermédiaire
                    gradient.addColorStop(0.47, "magenta"); // Intermédiaire
                    gradient.addColorStop(0.5, "rgb(0,100,255)"); // Intermédiaire
                    gradient.addColorStop(0.52, "rgb(0,100,255)"); // Intermédiaire
                    gradient.addColorStop(0.53, "rgb(0,150,255)"); // Intermédiaire
                    gradient.addColorStop(0.55, "rgb(0,200,255)"); // Intermédiaire
                    gradient.addColorStop(0.58, "rgb(0,200,255)"); // Intermédiaire
                    gradient.addColorStop(0.6, "green"); // Intermédiaire
                    gradient.addColorStop(0.8, "yellow"); // Intermédiaire
                    gradient.addColorStop(1, "red"); // Arrivée
                    ctx.fillStyle = gradient; // Affectation au remplissage
                    ctx.fillRect(0, 0, maxlarge, maxheight);
                }
                function getpixelcolor(e) {
                    var back1 = actifelem.getAttribute("back1");
                    if (back1 == null) {
                        back1 = "#FFFFFF";
                    };
                    var back2 = actifelem.getAttribute("back2");
                    var bord1 = actifelem2.getAttribute("bord1");
                    if (bord1 == null) {
                        bord1 = "#FFFFFF";
                    };
                    var bord2 = actifelem2.getAttribute("bord2");
                    var pourcentage = actifelem.getAttribute("pourcentage");
                    if (pourcentage == null) {
                        pourcentage = " 0%"
                    };
                    var Kanvas = document.getElementById(e.target.id)
                    // alert(e.target.id +" et sa classe est  :"+ e.target.className);
                    var rect = e.target.getBoundingClientRect();
                    X = (e.pageX - rect.left);
                    Y = e.pageY - rect.top;
                    var ctx = e.target.getContext('2d');
                    var c = ctx.getImageData(Math.round(X), Math.round(Y), 1, 1).data;
                    var hex = "#" + ("000000" + rgbToHex(c[0], c[1], c[2])).slice(-6);
     
                    // //////////////////pour le background          
                    //if (e.target.id == "palcouleur" && e.target.className == "mov" && modepal == "backgrounddiv") {
                    if (e.target.id == "palcouleur" &&  modepal == "backgrounddiv") {
     
                        back1 = hex;
                        if (back2 == null) {
                            actifelem.style.backgroundColor = hex;
                            actifelem.setAttribute("back1", hex);
                        };
                        if (back2 != null) {
                            actifelem.style.background = "-ms-linear-gradient(" + "top" + "," + back1 + "," + back2 + ")";
                            actifelem.setAttribute("back1", hex);
                        }
                    }
                    //if (e.target.id == "palcouleur2" && e.target.className == "mov" && modepal == "backgrounddiv") {
                    if (e.target.id == "palcouleur2" && modepal == "backgrounddiv") {
     
                        back2 = hex;
                        actifelem.setAttribute("back2", hex);
                        actifelem.style.background = "-ms-linear-gradient(" + "top" + "," + back1 + pourcentage + "," + back2 + ")";
                    }
                    //if (e.target.id=="palcouleur" && e.target.className=="mov" && modepal=="bordercolor"){actifelem.style.borderColor=hex;actifelem.setAttribute("bord1",hex);}
                    //if ( e.target.id=="palcouleur2" && e.target.className=="mov" && modepal=="bordercolor"){actifelem.style.borderColor=hex;actifelem.setAttribute("bord2",hex);}
                    /////////////////////////FINI POUR LE BACKGROUND     
     
                    /////////////////POUR LES BORDURES
                    //if (e.target.id == "palcouleur" && e.target.className == "mov" && modepal == "bordercolor") {
                    if (e.target.id == "palcouleur" && modepal == "bordercolor") {
     
                        bord1 = hex;
                        if (bord2 == null) {
                            actifelem2.style.backgroundColor = hex;
                            actifelem2.setAttribute("bord1", hex);
                        };
                        if (bord2 != null) {
                            actifelem2.style.background = "-ms-linear-gradient(" + "top" + "," + bord1 + "," + bord2 + ")";
                            actifelem2.setAttribute("bord1", hex);
                        }
                    }
                    //if (e.target.id == "palcouleur2" && e.target.className == "mov" && modepal == "bordercolor") {
                    if (e.target.id == "palcouleur2" && modepal == "bordercolor") {
     
                        bord2 = hex;
                        actifelem2.setAttribute("bord2", hex);
                        actifelem2.style.background = "-ms-linear-gradient(" + "top" + "," + bord1 + "," + bord2 + ")";
                        //code en CSS exemple =border-image:linear-gradient(to bottom, black, rgba(0, 0, 0, 0)) 1 100%;
                    }
                    /////////////////FINI POUR LES BORDURES
     
                }
                function rgbToHex(r, g, b) {
                    if (r > 255 || g > 255 || b > 255)
                        throw "Invalid color component";
                    return ((r << 16) | (g << 8) | b).toString(16);
                }
     
                function initbout() {
                    draw("palcouleur");
                    draw("palcouleur2");
                    actifelem = document.getElementById("divtest");
        actifelem2 = document.getElementById("divtest2");
                    document.getElementById('palcouleur').addEventListener("mousemove", getpixelcolor, false);
                    document.getElementById("palcouleur").addEventListener("mousedown", function() {
                        this.className = "mov";
                    });
                    document.getElementById("palcouleur").addEventListener("mouseup", function() {
                        this.className = "nomov";
                    });
                    document.getElementById('palcouleur2').addEventListener("mousemove", getpixelcolor, false);
                    document.getElementById("palcouleur2").addEventListener("mousedown", function() {
                        this.className = "mov";
                    });
                    document.getElementById("palcouleur2").addEventListener("mouseup", function() {
                        this.className = "nomov";
                    });
     
                    document.getElementById("bordercolor").addEventListener("click", function() {
                        modepal = "bordercolor";
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menupal");
                        oldmenu.style.visibility = "visible";
                    });
                    document.getElementById("backcouleurdiv").addEventListener("click", function() {
                        modepal = "backgrounddiv";
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menupal");
                        oldmenu.style.visibility = "visible";
                    });
     
                    ////////////////////////////////////////////////////////////////////////////////////////////////evenement menu coin 
                    document.getElementById("coin").addEventListener("click", function() {
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menucoin");
                        oldmenu.style.visibility = "visible";
                    });
                    document.getElementById("slidebordhg").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderTopLeftRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordhd").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderTopRightRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordbg").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderBottomLeftRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordbd").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderBottomRightRadius = this.value + "%";
                        };
                    });
                    document.getElementById("slidebordfour").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderRadius = this.value + "%";
                        };
                    });
                    ///////////////////////////////////////////////////////////////////////////////////////////////////fin du menu coin
     
                    document.getElementById("borderwidth").addEventListener("click", function() {
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menuborderwidth");
                        oldmenu.style.visibility = "visible";
                        oldmenu.zIndex = 100;
                        document.getElementById("slidebordwidth").value = Math.round(actifelem.style.borderWidth.replace("px", ""));
                    });
                    document.getElementById("slidebordwidth").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderWidth = this.value + "px";
                        };
                    });
     
     
                }
            </script>
        </head>
        <body>
            <div id="menudiv" class="menusup" style="width:470px;height:220px;  ">
                <button class="btclose">X</button>
                <div class="selects2" id="mmenuaction" style="position:absolute; left:10px;top:10px;width:120px;height:185px;">
                    <button class="rad" id="ajoutdiv" style="height:30px;">Ajouter un div</button>
                    <button class="rad" id="coin" style="height:30px;">Arrondi des coins</button>
                    <button class="rad" id="borderwidth" style="height:30px;">BorderWidth</button>
                    <button class="rad" id="bordercolor" style="height:30px;">Bordercolor</button>
                    <button class="rad" id="backcouleurdiv" style="height:30px;">Background Color</button>
                    <button class="rad" id="backgroundgradient" style="height:30px;">Bacground gtadient</button>
                </div>
       <!------------------------------------------->
                <div class="selects2" id="menucoin" style="position:absolute; width:300px;height:150px;left: 160px;top:30px;margin-right:1px; visibility:visible ; ">
                    <p class="slideImpRa" id=o ne>
                        <label class="labslide" for="slidebordhg">coin Haut Gauche :</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordhg">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordhd">coin Haut droite :&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordhd">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordbg">coin Bas  Gauche :&nbsp;&nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordbg">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordbd">coin Bas  Droite  :&nbsp;&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordbd">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordfour">les quate angles :&nbsp;&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="50" id="slidebordfour">
                    </p>
                </div>
                <div class="selects2" id="menupal" style="position:absolute; width:300px;height:150px;left: 160px;top:30px;margin-right:1px;visibility:hidden ; ">
                    <canvas class="nomov" id="palcouleur" style="margin-left:10px;width:130px;height:75px;border:1px solid red;"></canvas>
                    <canvas class="nomov" id="palcouleur2" style="margin-left:10px;width:130px;height:75px;border:1px solid red;"></canvas>
                </div>
                <div class="selects2" id="menuborderwidth" style="position:absolute; width:300px;height:150px;left: 160px;top:30px;margin-right:1px;visibility:hidden ; ">
                    <p> Modifier l'épaisseur des bordures du div actif</p>
                    <p style="margin-top:10px;">
                        <input type="range" min="0" max="50" id="slidebordwidth">
                    </p>
                </div>
            </div>
      <div id="divtest2" style="left: 50px; top: 250px; width: 400px; height: 300px; position: absolute;background-color:red;z-index:1">
       <div id="divtest" style="left: 15px; top: 15px; width: 370px; height: 270px; position: relative;background-color:white;z-index:0">
     
       </div>
      </div>
            <script>
                initbout();
            </script>
        </body>
    </html>
    Nom : 170221-001.JPG
Affichages : 156
Taille : 39,0 Ko

    Nom : 170221-002.JPG
Affichages : 171
Taille : 38,0 Ko
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  14. #14
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    Par défaut re
    oui les effet c'est ce que je cherche
    oui tu a testé mes slidebordurespour les formes ca c'est bon on touche plus

    allez je suis aller au bout cette fois hihhiihi
    regarde
    Nom : demo2.gif
Affichages : 172
Taille : 1,56 Mo
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  15. #15
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    Par défaut re
    Bonjour badaze et a tous
    voila tout est bon sauf une chose
    quand je change d'avis et que j'enleve la 2d couleur la couleur 1 est invisible .
    je suis obligé de deplacer le curseur transparence couleur 1 pour la revoir apparaître
    une idée du pour quoi

    le code complet
    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
    <!DOCTYPE HTML ><html lang="fr">
     
     
    <head>
        <!--meta charset="utf-8"-->
        <title>patrick WYSIWYG html </title>
     
     
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
     
     
        <head>
            <!--meta charset="utf-8"-->
            <title>patrick WYSIWYG html </title>
     
     
            <meta http-equiv="X-UA-Compatible" content="IE=11">
     
     
     
     
            <style>
                .slideImpRa {
                    margin: 0;
                    margin-top: -35px;
                    width: 300px;
                    vertical-align: middle;
                }
     
                .slide {
                    width: 150px;
                } //border:1px solid gray;
                #.labslide {
                    width: 260px;
                }
     
                #one {
                    margin-top: 0;
                }
     
                .selects2 {
                    border: 1px solid white;
                    background-color: #9AB9C3;
                    position: relative;
                    z-index: 100;
                    width: 150px;
                    font-size: 15px;
                }
     
                .menusup {
                    position: relative;
                    border: 1px solid #607F94;
                    z-index: 100;
                    background-color: #ACC3CB;
                    border-radius: 5px;
                }
     
                .rad {
                    color: #086A87;
                    border-radius: 4px;
                    BORDER-TOP: #607f94 0.1pt solid;
                    HEIGHT: 100%;
                    BORDER-RIGHT: #607f94 0.1pt solid;
                    WIDTH: 100%;
                    BORDER-BOTTOM: #607f94 0.1pt solid;
                    BORDER-LEFT: #607f94 0.1pt solid;
                    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(149, 171, 185, 0.65) 69%);
                }
     
                .rad:hover {
                    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 0%, rgba(66, 137, 178, 0.65) 69%);
                    color: white;
                }
     
                .btclose {
                    width20px;
                    height: 20px;
                    background-color: gray;
                    color: red;
                    float: right;
                    margin: 2px;
                }
     
                .btclose:hover {
                    background-color: red;
                    color: gray;
                }
            </style>
            <script>
                var actifelem
                var oldmenu;
                var modepal;
     
     
                function draw(elempalid) {
                    var maxlarge = document.getElementById(elempalid).offsetWidth;
                    var maxheight = document.getElementById(elempalid).offsetHeight;
                    document.getElementById(elempalid).setAttribute('width', maxlarge);
                    document.getElementById(elempalid).setAttribute('height', maxheight)
     
     
                    var ctx = document.getElementById(elempalid).getContext('2d');
                    var gradient = ctx.createLinearGradient(0, 0, maxlarge, 0); ///vertical
                    //var gradient = ctx.createLinearGradient(0,0,0,maxheight);//horizontal
                    //var gradient = ctx.createLinearGradient(0,0,maxlarge,maxheight);//vertical oblique
                    gradient.addColorStop(0, "white"); // Départ
                    gradient.addColorStop(0.1, "black"); // Départ
     
     
                    gradient.addColorStop(0.2, "rgb(255,100,100)"); // Intermédiaire
                    gradient.addColorStop(0.3, "blue"); // Intermédiaire
                    gradient.addColorStop(0.4, "magenta"); // Intermédiaire
                    gradient.addColorStop(0.43, "rgb(255,150,255)"); // Intermédiaire
                    gradient.addColorStop(0.47, "magenta"); // Intermédiaire
                    gradient.addColorStop(0.5, "rgb(0,100,255)"); // Intermédiaire
                    gradient.addColorStop(0.52, "rgb(0,100,255)"); // Intermédiaire
     
     
                    gradient.addColorStop(0.53, "rgb(0,150,255)"); // Intermédiaire
                    gradient.addColorStop(0.55, "rgb(0,200,255)"); // Intermédiaire
                    gradient.addColorStop(0.58, "rgb(0,200,255)"); // Intermédiaire
     
     
                    gradient.addColorStop(0.6, "green"); // Intermédiaire
                    gradient.addColorStop(0.8, "yellow"); // Intermédiaire
                    gradient.addColorStop(1, "red"); // Arrivée
     
     
                    ctx.fillStyle = gradient; // Affectation au remplissage
                    ctx.fillRect(0, 0, maxlarge, maxheight);
                }
     
     
                function getpixelcolor(e) {
                    var back1 = actifelem.getAttribute("back1");
                    if (back1 == null) {
                        back1 = "#FFFFFF";
                    };
                    var back2 = actifelem.getAttribute("back2");
                    var bord1 = actifelem.getAttribute("bord1");
                    if (bord1 == null) {
                        bord1 = "#000000";
                    };
                    var bord2 = actifelem.getAttribute("bord2");
                    var percent1 = actifelem.getAttribute("percent1");
                    if (percent1 == null) {
                        percent1 = "1";
                        actifelem.setAttribute('percent1', "0%");
                    };
                    var percent2 = actifelem.getAttribute("percent2");
                    if (percent2 == null) {
                        percent2 = "1";
                        actifelem.setAttribute('percent2', "100%");
                    };
                    var trans1 = actifelem.getAttribute("trans1");
                    if (trans1 == null) {
                        trans1 = "1";
                        actifelem.setAttribute('trans1', "1");
                    };
                    var trans2 = actifelem.getAttribute("trans2");
                    if (trans2 == null) {
                        trans2 = "1";
                        actifelem.setAttribute('trans2', "1");
                    };
                    var Kanvas = document.getElementById(e.target.id)
     
     
                    // alert(e.target.id +" et sa classe est  :"+ e.target.className);
                    var rect = e.target.getBoundingClientRect();
                    X = (e.pageX - rect.left);
                    Y = e.pageY - rect.top;
                    var ctx = e.target.getContext('2d');
                    var c = ctx.getImageData(Math.round(X), Math.round(Y), 1, 1).data;
                    var hex = "#" + ("000000" + rgbToHex(c[0], c[1], c[2])).slice(-6);
                    // //////////////////pour le background          
                    if (e.target.id == "palcouleur" && e.target.className == "mov" && modepal == "backgrounddiv") {
                        //back1=hex;
                        back1 = "rgba(" + c[0] + "," + c[1] + "," + c[2] + "," + "trans" + ")"
                        if (back2 == null) {
                            actifelem.style.backgroundColor = back1.replace("trans", trans1);
                            actifelem.setAttribute("back1", back1);
                        };
     
     
                        if (back2 != null) {
                            actifelem.style.background = "-ms-linear-gradient(" + "top" + "," + back1.replace("trans", trans1) + percent1 + "," + back2.replace("trans", trans2) + percent2 + ")";
                            actifelem.setAttribute("back1", back1);
                        }
                    }
                    if (e.target.id == "palcouleur2" && e.target.className == "mov" && modepal == "backgrounddiv") {
                        //back2=hex;
                        back2 = "rgba(" + c[0] + "," + c[1] + "," + c[2] + "," + "trans" + ")"
                        actifelem.setAttribute("back2", back2);
     
     
                        actifelem.style.background = "-ms-linear-gradient(" + "top" + "," + back1.replace("trans", trans1) + percent1 + "," + back2.replace("trans", trans2) + percent2 + ")";
                    }
                    //if (e.target.id=="palcouleur" && e.target.className=="mov" && modepal=="bordercolor"){actifelem.style.borderColor=hex;actifelem.setAttribute("bord1",hex);}
                    //if ( e.target.id=="palcouleur2" && e.target.className=="mov" && modepal=="bordercolor"){actifelem.style.borderColor=hex;actifelem.setAttribute("bord2",hex);}
                    /////////////////////////FINI POUR LE BACKGROUND           
     
     
                    /////////////////POUR LES BORDURES
                    if (e.target.id == "palcouleur" && e.target.className == "mov" && modepal == "bordercolor") {
                        bord1 = hex;
                        if (bord2 == null) {
                            actifelem.style.borderColor = hex;
                            actifelem.setAttribute("bord1", hex);
                        };
                        if (bord2 != null) {
                            actifelem.style.borderImage = "-ms-linear-gradient(" + "top" + "," + bord1 + "," + bord2 + "," + bord1 + ") 1 100%";
                            actifelem.setAttribute("bord1", hex);
                        }
                    }
                    if (e.target.id == "palcouleur2" && e.target.className == "mov" && modepal == "bordercolor") {
                        bord2 = hex;
                        actifelem.setAttribute("bord2", hex);
                        actifelem.style.borderImage = "-ms-linear-gradient(" + bord1 + "," + bord2 + ")" + actifelem.style.borderWidth.replace("px", "");
                        //code en CSS exemple =border-image:linear-gradient(to bottom, black, rgba(0, 0, 0, 0)) 1 100%;
                        //border-image: linear-gradient(red, yellow) 10;
                    }
     
     
                    /////////////////FINI POUR LES BORDURES
     
     
     
     
                }
     
     
                function rgbToHex(r, g, b) {
                    if (r > 255 || g > 255 || b > 255)
                        throw "Invalid color component";
                    return ((r << 16) | (g << 8) | b).toString(16);
                }
     
     
                function transparence(e) {
     
     
                    if (e.target.id == "transp1") {
                        actifelem.setAttribute("trans1", e.target.value / 100);
                        var back1 = actifelem.getAttribute("back1").replace("trans", e.target.value / 100);
                        var percent1 = actifelem.getAttribute("percent1");
                        var back2 = actifelem.getAttribute("back2");
                        var trans2 = actifelem.getAttribute("trans2");
                        if (back2 != null) {
                            back2 = actifelem.getAttribute("back2").replace("trans", trans2);
                            actifelem.style.background = "-ms-linear-gradient(" + "top" + "," + back1 + percent1 + "," + back2 + "100%" + ")";
                        };
                        if (back2 == null) {
                            actifelem.style.backgroundColor = back1;
                        };
     
     
                    }; //fin du if back1
                    if (e.target.id == "transp2") {
                        if (actifelem.getAttribute("back2") != null) {
                            actifelem.setAttribute("trans2", e.target.value / 100);
                            var back2 = actifelem.getAttribute("back2").replace("trans", e.target.value / 100);
                            var back1 = actifelem.getAttribute("back1").replace("trans", actifelem.getAttribute("trans1"));
                            var percent1 = actifelem.getAttribute("percent1");
     
     
     
     
                            //alert("-ms-linear-gradient("+"top" + "," +back1+ percent1 +","+back2+percent2+")");
                            actifelem.style.background = "-ms-linear-gradient(" + "top" + "," + back1 + percent1 + "," + back2 + "100%" + ")";
                        } else {
                            e.target.value = "100";
                        }
                    }; //fin du if back2
                }
     
     
                function pourcentage(e) {
                    if (actifelem.getAttribute("back2") != null) {
                        actifelem.setAttribute("percent1"), e.target.value + "%";
                        var back2 = actifelem.getAttribute("back2").replace("trans", actifelem.getAttribute("trans1"));
                        var back1 = actifelem.getAttribute("back1").replace("trans", actifelem.getAttribute("trans2"));
                        actifelem.style.background = "-ms-linear-gradient(" + "top" + "," + back1 + e.target.value + "%" + "," + back2 + "100%" + ")";
     
     
                    } else {
                        e.target.value = "0";
                    }
                }
     
     
                function supprback2(e) {
                    var trans1 = actifelem.getAttribute("trans1");
                    var back1 = actifelem.getAttribute("back1").replace("trans", "100");
                    actifelem.style.background = "none"
                    actifelem.backgroundColor = back1;
                    actifelem.removeAttribute("back2");
                    actifelem.removeAttribute("trans2");
                    document.getElementById("transp1").focus
                    document.getElementById("transp1").value = 100;
                }
     
     
     
     
                function initbout() {
                    draw("palcouleur");
                    draw("palcouleur2");
     
     
                    actifelem = document.getElementById("divtest");
                    document.getElementById("transp1").addEventListener("change", transparence, false);
                    document.getElementById("transp2").addEventListener("change", transparence, false);
                    document.getElementById("pourcent").addEventListener("change", pourcentage, false);
                    document.getElementById("supback2").addEventListener("click", supprback2, false);
                    supback2
                    document.getElementById('palcouleur').addEventListener("mousemove", getpixelcolor, false);
                    document.getElementById("palcouleur").addEventListener("mousedown", function() {
                        this.className = "mov";
                    });
                    document.getElementById("palcouleur").addEventListener("mouseup", function() {
                        this.className = "nomov";
                    });
     
     
                    document.getElementById('palcouleur2').addEventListener("mousemove", getpixelcolor, false);
                    document.getElementById("palcouleur2").addEventListener("mousedown", function() {
                        this.className = "mov";
                    });
                    document.getElementById("palcouleur2").addEventListener("mouseup", function() {
                        this.className = "nomov";
                    });
     
     
     
     
                    document.getElementById("bordercolor").addEventListener("click", function() {
                        modepal = "bordercolor";
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menupal");
                        oldmenu.style.visibility = "visible";
                    });
     
     
                    document.getElementById("backcouleurdiv").addEventListener("click", function() {
                        modepal = "backgrounddiv";
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menupal");
                        oldmenu.style.visibility = "visible";
                    });
     
     
     
     
     
     
                    ////////////////////////////////////////////////////////////////////////////////////////////////evenement menu coin 
                    document.getElementById("coin").addEventListener("click", function() {
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menucoin");
                        oldmenu.style.visibility = "visible";
                    });
     
     
                    document.getElementById("slidebordhg").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderTopLeftRadius = this.value + "%";
                        };
                    });
     
     
                    document.getElementById("slidebordhd").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderTopRightRadius = this.value + "%";
                        };
                    });
     
     
                    document.getElementById("slidebordbg").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderBottomLeftRadius = this.value + "%";
                        };
                    });
     
     
                    document.getElementById("slidebordbd").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderBottomRightRadius = this.value + "%";
                        };
                    });
     
     
                    document.getElementById("slidebordfour").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderRadius = this.value + "%";
                        };
                    });
                    ///////////////////////////////////////////////////////////////////////////////////////////////////fin du menu coin
     
     
     
     
                    document.getElementById("borderwidth").addEventListener("click", function() {
                        if (oldmenu != null) {
                            oldmenu.style.visibility = "hidden";
                        };
                        oldmenu = document.getElementById("menuborderwidth");
                        oldmenu.style.visibility = "visible";
                        oldmenu.zIndex = 100;
                        document.getElementById("slidebordwidth").value = Math.round(actifelem.style.borderWidth.replace("px", ""));
                    });
     
     
                    document.getElementById("slidebordwidth").addEventListener("change", function() {
                        if (actifelem != null) {
                            actifelem.style.borderWidth = this.value + "px";
                        };
                    });
     
     
     
     
     
     
     
     
                }
            </script>
     
     
        </head>
     
     
        <body>
            <div id="menudiv" class="menusup" style="width:570px;height:220px;  ">
                <button class="btclose">X</button>
                <div class="selects2" id="mmenuaction" style="position:absolute; left:10px;top:10px;width:120px;height:185px;">
                    <button class="rad" id="ajoutdiv" style="height:30px;">Ajouter un div</button>
                    <button class="rad" id="coin" style="height:30px;">Arrondi des coins</button>
                    <button class="rad" id="borderwidth" style="height:30px;">BorderWidth</button>
                    <button class="rad" id="bordercolor" style="height:30px;">Bordercolor</button>
                    <button class="rad" id="backcouleurdiv" style="height:30px;">Background Color</button>
                    <button class="rad" id="backgroundgradient" style="height:30px;">Bacground gtadient</button>
                </div>
                <!------------------------------------------->
     
     
                <div class="selects2" id="menucoin" style="position:absolute; width:300px;height:150px;left: 160px;top:30px;margin-right:1px; visibility:visible ; ">
                    <p class="slideImpRa" id=o ne>
                        <label class="labslide" for="slidebordhg">coin Haut Gauche :</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordhg">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordhd">coin Haut droite :&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordhd">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordbg">coin Bas  Gauche :&nbsp;&nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordbg">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordbd">coin Bas  Droite  :&nbsp;&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="100" id="slidebordbd">
                    </p>
                    <p class="slideImpRa">
                        <label for="slidebordfour">les quate angles :&nbsp;&nbsp; &nbsp;</label>
                        <input class="slide" type="range" min="0" max="50" id="slidebordfour">
                    </p>
                </div>
                <!------------------------------------------->
     
     
                <div class="selects2" id="menupal" style="position:absolute; width:400px;height:150px;left: 135px;top:25px;margin-right:1px;visibility:hidden ; ">
                    <canvas class="nomov" id="palcouleur" style="margin-left:10px;width:180px;height:75px;border:1px solid red;"></canvas>
                    <canvas class="nomov" id="palcouleur2" style="margin-left:10px;width:180px;height:75px;border:1px solid red;"></canvas>
                    <input id="transp1" title="TRANSPARENCE COULEUR 1" type="range" style=" position:absolute;top:70px;left:10px;width:130px;">
                    <input id="transp2" title="TRANSPARENCE COULEUR 2" type="range" style=" position:absolute;top:70px;left:260px;width:130px;">
                    <input id="pourcent" title="POURCENTAGE DE LA COULEUR " type="range" style=" position:absolute;top:100px;left:60px;width:280px;">
                    <button class="rad" id="supback2" ) title "SUPPRIMER LA COULEUR 2" style="position:absolute;left:230px;top:80px;width:25px;height:25px;">X</button>
     
     
                </div>
                <!------------------------------------------->
     
     
                <div class="selects2" id="menuborderwidth" style="position:absolute; width:300px;height:150px;left: 160px;top:30px;margin-right:1px;visibility:hidden ; ">
                    <p> Modifier l'épaisseur des bordures du div actif</p>
                    <p style="margin-top:10px;">
                        <input type="range" min="0" max="50" id="slidebordwidth">
                    </p>
                </div>
                <!------------------------------------------->
            </div>
            <div id="poussetoii" style="border: 15px solid blue;position:absolute;left:150px;top:350px;width:400px;height:300px;"></div>
     
     
            <div id="divtest" style="border: 15px solid red;position:absolute;left:50px;top:250px;width:400px;height:300px;"></div>
     
     
            <script>
                initbout();
            </script>
        </body>
     
     
    </html>
    Nom : demo2.gif
Affichages : 176
Taille : 466,2 Ko
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  16. #16
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
                function supprback2(e) {
                    var trans1 = actifelem.getAttribute("trans1");
                    var back1 = actifelem.getAttribute("back1").replace("trans", "100");
                    <!-- actifelem.style.background = "none" -->
                    actifelem.backgroundColor = back1;
                    actifelem.removeAttribute("back2");
                    actifelem.removeAttribute("trans2");
                    document.getElementById("transp1").focus
                    document.getElementById("transp1").value = 100;
                }
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

  17. #17
    Inactif  

    Homme Profil pro
    cuisiniste
    Inscrit en
    Avril 2009
    Messages
    15 379
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Var (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cuisiniste
    Secteur : Bâtiment

    Informations forums :
    Inscription : Avril 2009
    Messages : 15 379
    Points : 12 075
    Points
    12 075
    Billets dans le blog
    8
    Par défaut re
    Bonsoir badaze je fait déjà comme ca et ça ne fait pas l'effet voulu
    Nom : demo2.gif
Affichages : 193
Taille : 791,8 Ko
    mes fichiers dans les contributions:
    mail avec CDO en vba et mail avec CDO en vbs dans un HTA
    survol des bouton dans userform
    prendre un cliché d'un range

    si ton problème est résolu n'oublie pas de pointer : : ça peut servir aux autres
    et n'oublie pas de voter

  18. #18
    Membre émérite
    Avatar de badaze
    Homme Profil pro
    Chef de projets info
    Inscrit en
    Septembre 2002
    Messages
    1 412
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Chef de projets info
    Secteur : Transports

    Informations forums :
    Inscription : Septembre 2002
    Messages : 1 412
    Points : 2 522
    Points
    2 522
    Par défaut
    Situation initiale :
    Nom : 170222-001.JPG
Affichages : 125
Taille : 46,3 Ko

    Je clique sur X. Le curseur monte à 100% et le fond ne change pas.
    Nom : 170222-002.JPG
Affichages : 141
Taille : 44,8 Ko
    Cela ne sert à rien d'optimiser quelque chose qui ne fonctionne pas.

    Mon site : www.emmella.fr

    Je recherche le manuel de l'Olivetti Logos 80B.

Discussions similaires

  1. [Java][debutant]select count(*) ne retourne rien !!
    Par Invité dans le forum SQL Procédural
    Réponses: 3
    Dernier message: 24/01/2007, 11h39
  2. Fonction ne retournant rien ?
    Par bds2006 dans le forum Delphi
    Réponses: 8
    Dernier message: 05/06/2006, 14h47
  3. Erreur query ne retourne rien
    Par TeddyBEER dans le forum Outils
    Réponses: 3
    Dernier message: 28/04/2006, 15h09
  4. Si mysql ne retourne rien que faire ?
    Par pierrera dans le forum Requêtes
    Réponses: 3
    Dernier message: 08/02/2006, 11h12
  5. SELECT qui ne retourne rien à cause d'anti-slash
    Par mikyfpc dans le forum Outils
    Réponses: 8
    Dernier message: 07/08/2005, 23h04

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