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 :

Insertion données via javascript dans ma bdd


Sujet :

JavaScript

  1. #1
    Candidat au Club
    Homme Profil pro
    operateur logistique
    Inscrit en
    Septembre 2018
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : operateur logistique
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Septembre 2018
    Messages : 1
    Points : 3
    Points
    3
    Par défaut Insertion données via javascript dans ma bdd
    Bonjour tous le monde,

    J'ai besoin de votre aide, j'ai une roulette qui fonctionne très bien sauf que je ne parviens pas à trouver la solution pour insérer le gain dans ma bdd.

    Voici mon code javascript :

    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
    <script>
                // Create new wheel object specifying the parameters at creation time.
                var theWheel = new Winwheel({
                    'numSegments'   : 16,   // Specify number of segments.
                    'outerRadius'   : 212,  // Set radius to so wheel fits the background.
                    'innerRadius'   : 120,  // Set inner radius to make wheel hollow.
                    'textFontSize'  : 16,   // Set font size accordingly.
                    'textMargin'    : 0,    // Take out default margin.
                    'segments'      :       // Define segments including colour and text.
                    [
                       {'fillStyle' : '#eae56f', 'text' : '1 MasterBall'},
                       {'fillStyle' : '#89f26e', 'text' : '1000 P$'},
                       {'fillStyle' : '#7de6ef', 'text' : '1 HyperBall'},
                       {'fillStyle' : '#e7706f', 'text' : '1 SuperBall'},
                       {'fillStyle' : '#eae56f', 'text' : '3 Suns'},
                       {'fillStyle' : '#89f26e', 'text' : '1 Pierre Feu'},
                       {'fillStyle' : '#7de6ef', 'text' : '500 P$'},
                       {'fillStyle' : '#e7706f', 'text' : '1 Caninos'},
                       {'fillStyle' : '#eae56f', 'text' : '2000 P$'},
                       {'fillStyle' : '#89f26e', 'text' : '5 PokeBall'},
                       {'fillStyle' : '#7de6ef', 'text' : '1 SuperBall'},
                       {'fillStyle' : '#e7706f', 'text' : '200 Miel'},
                       {'fillStyle' : '#eae56f', 'text' : '50 Miel'},
                       {'fillStyle' : '#89f26e', 'text' : '5 Suns'},
                       {'fillStyle' : '#7de6ef', 'text' : '500 P$'},
                       {'fillStyle' : '#e7706f', 'text' : '1500 P$'}
                    ],
                    'animation' :           // Define spin to stop animation.
                    {
                        'type'     : 'spinToStop',
                        'duration' : 5,
                        'spins'    : 8,
                        'callbackFinished' : alertPrize
                    }
                });
     
                // Vars used by the code in this page to do power controls.
                var wheelPower    = 0;
                var wheelSpinning = false;
     
                // -------------------------------------------------------
                // Function to handle the onClick on the power buttons.
                // -------------------------------------------------------
                function powerSelected(powerLevel)
                {
                    // Ensure that power can't be changed while wheel is spinning.
                    if (wheelSpinning == false)
                    {
                        // Reset all to grey incase this is not the first time the user has selected the power.
                        document.getElementById('pw1').className = "";
                        document.getElementById('pw2').className = "";
                        document.getElementById('pw3').className = "";
     
                        // Now light up all cells below-and-including the one selected by changing the class.
                        if (powerLevel >= 1)
                        {
                            document.getElementById('pw1').className = "pw1";
                        }
     
                        if (powerLevel >= 2)
                        {
                            document.getElementById('pw2').className = "pw2";
                        }
     
                        if (powerLevel >= 3)
                        {
                            document.getElementById('pw3').className = "pw3";
                        }
     
                        // Set wheelPower var used when spin button is clicked.
                        wheelPower = powerLevel;
     
                        // Light up the spin button by changing it's source image and adding a clickable class to it.
                        document.getElementById('spin_button').src = "spin_on.png";
                        document.getElementById('spin_button').className = "clickable";
                    }
                }
     
                // -------------------------------------------------------
                // Click handler for spin button.
                // -------------------------------------------------------
                function startSpin()
                {
                    // Ensure that spinning can't be clicked again while already running.
                    if (wheelSpinning == false)
                    {
                        // Based on the power level selected adjust the number of spins for the wheel, the more times is has
                        // to rotate with the duration of the animation the quicker the wheel spins.
                        if (wheelPower == 1)
                        {
                            theWheel.animation.spins = 3;
                        }
                        else if (wheelPower == 2)
                        {
                            theWheel.animation.spins = 8;
                        }
                        else if (wheelPower == 3)
                        {
                            theWheel.animation.spins = 15;
                        }
     
                        // Disable the spin button so can't click again while wheel is spinning.
                        document.getElementById('spin_button').src       = "spin_off.png";
                        document.getElementById('spin_button').className = "";
     
                        // Begin the spin animation by calling startAnimation on the wheel object.
                        theWheel.startAnimation();
     
                        // Set to true so that power can't be changed and spin button re-enabled during
                        // the current animation. The user will have to reset before spinning again.
                        wheelSpinning = true;
                    }
                }
     
                // -------------------------------------------------------
                // Function for reset button.
                // -------------------------------------------------------
                function resetWheel()
                {
                    theWheel.stopAnimation(false);  // Stop the animation, false as param so does not call callback function.
                    theWheel.rotationAngle = 0;     // Re-set the wheel angle to 0 degrees.
                    theWheel.draw();                // Call draw to render changes to the wheel.
     
                    document.getElementById('pw1').className = "";  // Remove all colours from the power level indicators.
                    document.getElementById('pw2').className = "";
                    document.getElementById('pw3').className = "";
     
                    wheelSpinning = false;          // Reset to false to power buttons and spin can be clicked again.
                }
     
                // -------------------------------------------------------
                // Called when the spin animation has finished by the callback feature of the wheel because I specified callback in the parameters.
                // note the indicated segment is passed in as a parmeter as 99% of the time you will want to know this to inform the user of their prize.
                // -------------------------------------------------------
                function alertPrize(indicatedSegment)
                {
                    // Do basic alert of the segment text. You would probably want to do something more interesting with this information.
                    alert("Tu remporte " + indicatedSegment.text);				
                }
            </script>
    Si vous pouviez m'aider se serais super.

    Merci par avance.

  2. #2
    Membre actif
    Inscrit en
    Août 2006
    Messages
    191
    Détails du profil
    Informations forums :
    Inscription : Août 2006
    Messages : 191
    Points : 263
    Points
    263
    Par défaut
    Bonjour,

    Ta demande est très/trop vague.

    Quelle base utilise-tu ? quel langage serveur utilise-tu ?

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

Discussions similaires

  1. Réponses: 6
    Dernier message: 24/02/2014, 15h55
  2. [MySQL] Insertion des données du formulaire dans une BDD
    Par OG__fenomeno dans le forum PHP & Base de données
    Réponses: 7
    Dernier message: 29/05/2013, 11h52
  3. Insertion d'un byte[] dans une bdd mssql 2005
    Par telynor dans le forum ASP.NET
    Réponses: 16
    Dernier message: 10/03/2007, 16h43
  4. [MySQL] insérer via saisie dans une bdd
    Par luciedoudou dans le forum PHP & Base de données
    Réponses: 8
    Dernier message: 16/01/2007, 10h34
  5. insertion d'un champs dans une bdd access
    Par pepper18 dans le forum SGBD
    Réponses: 1
    Dernier message: 26/05/2006, 19h47

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