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 :

Modification de script Calendrier


Sujet :

JavaScript

  1. #1
    Membre actif Avatar de Zebulon777
    Homme Profil pro
    Informaticien
    Inscrit en
    Février 2005
    Messages
    1 320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 57
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Informaticien

    Informations forums :
    Inscription : Février 2005
    Messages : 1 320
    Points : 286
    Points
    286
    Par défaut Modification de script Calendrier
    Bonjour à tous,
    j'ai récupéré un scrip de gestion de calendrier sur le net que je vous mets ici :



    Mais j'en appelle à votre aide :
    - je n'arrive pas à récupérer les valeurs.
    Je voudrais pouvoir récupérer les valeurs dans 3 variables : JJ, MM, AAAA.

    - impossible de rendre MODAL le popup qui s'ouvre : est-ce que c'est effectivement possible ?

    Merci d'avance.
    Zeb'

  2. #2
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Points : 4 835
    Points
    4 835
    Par défaut
    Salut ,
    d'une il manque le script et de deux, non on ne peut pas rendre modal une popup ( pas directement ... )

  3. #3
    Membre actif Avatar de Zebulon777
    Homme Profil pro
    Informaticien
    Inscrit en
    Février 2005
    Messages
    1 320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 57
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Informaticien

    Informations forums :
    Inscription : Février 2005
    Messages : 1 320
    Points : 286
    Points
    286
    Par défaut
    OUps, je vous mets le script...

    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
     
    //--------------------------------------------------------------------------------------
    // Calendrier (c) Serge (DarkSide) - Djibouti 2002  - 
    // Contact : sergebertet@voila.fr - http://www.merrouge.com/serge.htm
    //
    // Saisie d'une date dans un calendrier.
    // ------------------------------------
    // Utilisation :
    // Insérer le script dans l'entête du source HTML.
    // Placer, dans un formulaire nommé, le champs texte nommé destiné à recevoir la date
    // avec pour évènement souris ou clavier l'appel : MyGetDate(this);
    // Exemple de source HTML : 
    /*
     
     <HTML>
     <HEAD>
     <script src="calendar.js"></script>
     </HEAD>
     <BODY>
     <form name="NomDuFormulaire">
     <input type="texte" size="10" name="DateDeDebut" onClick="MyGetDate(this);">
     <input type="texte" size="10" name="DateDeFin" onClick="MyGetDate(this);">
     </form>
     </BODY>
     </HTML>
     
    */
    // Format de retour :
    // La date renvoyée est de type texte sous la forme jj/mm/aaaa
    //
    // Nota : Ne fonctionne que pour Internet Explorer.
    // ToDo : Rendre la fenêtre du calendrier Modale et dépendante de Opener
    //
    // Vous pouvez, bien sûr, utiliser ce script dans vos pages et ... 
    // me donner l'adresse pour que je voies ce que ça donne et ...
    // ce serait sympa de bien vouloir laisser les commentaires et ... c'est tout ... bon script.
    //-------------------------------------------------------------------------------------------
     
    function MyGetDate(champs) {
    IE = !(document.all?0:1);
    NS = !IE;
    dest = champs;
    if (IE) { 
    // Taille du calendrier
      larg = 250; 
      Long = 188;
      posX = event.screenX; posY = event.screenY;
      if (posX+larg > screen.width) posX = screen.width - larg;
      if (posY+Long > screen.height) posY = screen.height - Long;
      eval("maFen = window.open('','','top='+posY+',left='+posX+',width="+larg+",height="+Long+"');");
      maFen.focus();
      dessine();
      } 
    }
     
    function dessine() {
    txt = '\n\n\n<!--\n\nAuteur : DarkSide <sergebertet@voila.fr> - http://www.merrouge.com/serge.htm \n\n';
    txt += 'Ce script est disponible à l\'adresse : http://www.merrouge.com/calendar.zip \n\n-->\n\n\n';
    txt += '<html><head><title>Choisissez une date.</title>\n';
    txt += '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n';
    txt += '<script>\n';
    txt += 'var now = new Date();\nIE = !(document.all?0:1);\nNS = !IE;\n';
    txt += 'months = new Array(\'Janvier\',\'Février\',\'Mars\',\'Avril\',\'Mai\',\'Juin\',\'Juillet\',\'Août\',\'Septembre\',\'Octobre\',\'Novembre\',\'Décembre\');\n';
    txt += 'mois = now.getMonth();\nan = now.getFullYear();\njour = now.getDate();\nvide = "...";\n \n';
     
    // Affectation des dates aux bouttons
    txt += 'function init() {\n';
    txt += 'document.calendar.curMonth.value = months[mois] + " " + an;\n';
    txt += 'document.calendar.curMonth.readOnly = true;\n';
    txt += 'now.setMonth(mois);\n';
    txt += 'now.setYear(an);\n';
    txt += 'now.setDate(1);\n';
    txt += 'for (i=0;i<now.getDay();i++) { eval("document.calendar.b"+0+i+".value = \' " + vide + " \' ;"); }\n';
    txt += 'for (i=now.getDay();i<7;i++) {\n';
    txt += '	    jour = "0"+now.getDate();\n';
    txt += '		eval("document.calendar.b"+0+i+".value = \' "+jour+" \';");\n';
    txt += '		now.setDate(now.getDate()+1);\n';
    txt += '		}\n';
    txt += 'for (j=1;j<6;j++) {\n';
    txt += '	for (i=0;i<7;i++) {\n';
    txt += '		if (jour==vide || now.getDate() < jour) { jour = vide; } else { jour = now.getDate(); }\n';
    txt += '		if (jour < 10) { jour = "0"+jour; }\n';
    txt += '		eval("document.calendar.b"+j+i+".value = \' "+jour+" \' ;");\n';
    txt += '		now.setDate(now.getDate()+1);\n';
    txt += '		}\n';
    txt += '	}\n';
    txt += '}\n\n';
     
    // Mois suivant
    txt += 'function next() {\n';
    txt += 'if (mois == 11) { mois = 0; an = an + 1; } else { mois += 1; }\n';
    txt += 'init();\n';
    txt += '}\n\n';
     
    // Mois précédent
    txt += 'function prev() {\n';
    txt += 'if (mois == 0) { mois = 11; an -= 1; } else { mois -= 1; }\n';
    txt += 'init();\n';
    txt += '}\n\n';
     
    // 
    txt += 'function lz(valeur) { if (valeur < 10) return("0"+valeur); else return(valeur); }\n\n';
     
    // retour et fermeture du calendrier
    txt += 'function done(but) {\n';
    txt += 'txt = but.value.substr(1,2);\n';
    txt += 'if (txt == vide.substr(1,2)) return;\n';
     
    /*
       Si on veut l'année sur 2 digits, ajouter ligne suivante :
       txt += 'an = an+""; an = an.substr(2,2);'; // Y2K compliant :o) comme ils disent là-bas.
    */
     
    txt += 'txt = txt+"/"+lz(mois+1)+"/"+an;\n';
    //txt += 'opener.document.' + dest.form.name + '.' + dest.name + '.value = txt;\n';
    txt += 'window.close();\n';
    txt += '}\n';
     
    txt += '</script>\n</head>\n<style>\n';
    txt += 'td { color: white; font-weight: bold; text-align: center; }\n';
     
    // Couleur des boutons
    txt += 'input { cursor: hand; font-weight: bold; text-align: center; color: blue; background-color: silver; }\n';
     
    // Texte
    txt += 'td { font-size: 14px; }\n';
     
    // Couleurs de fond de table et de document
    txt += 'body { background: black; }\n';
    txt += 'table { background: black; }\n</style>\n';
    txt += '<body leftmargin="0" topmargin="0"; onLoad="init();">\n';
    txt += '<form name="calendar">\n';
    txt += '<table border="0" cellspacing="0" cellpadding="0" bgcolor="#00CCFF" align=center>\n';
    txt += '<tr><td>Dim</td><td>Lun</td><td>Mar</td><td>Mer</td><td>Jeu</td><td>Ven</td><td>Sam</td></tr>\n';
     
    // Création des bouttons
    for (i=0;i<6;i++) {
      txt += '<tr>\n';
      for (j=0;j<7;j++) {
    	txt += '<td><input type="button" name="b'+i+j+'" onclick="done(this)"></td>\n';
        }
      txt += '</tr>\n';
      } 
    txt += '<tr><td>\n';
    txt += '<input type="button" name="bk" value="<< " onclick="prev()"></td><td colspan=5>\n';
    txt += '<input type="text" name="curMonth" size="20">\n';
    txt += '</td><td><input type="button" name="bk" value=" >>" onclick="next()">\n';
    txt += '</td></tr></table></form></body>\n';
     
    // Création de la page
    txt += '<script>\n';
    txt += 'init();\n';
    txt += '</script></html>\n';
    maFen.document.write(txt);
    }
    Merci d'avance pour votre aide...Et s'il y a plus simple et plus facile à mettre en oeuvre, je suis preneur...

  4. #4
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Points : 4 835
    Points
    4 835
    Par défaut
    Merci d'avance pour votre aide...Et s'il y a plus simple et plus facile à mettre en oeuvre, je suis preneur...
    je te renvois donc ici :

    http://www.developpez.net/forums/sho...d.php?t=443310

  5. #5
    Membre actif Avatar de Zebulon777
    Homme Profil pro
    Informaticien
    Inscrit en
    Février 2005
    Messages
    1 320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 57
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Informaticien

    Informations forums :
    Inscription : Février 2005
    Messages : 1 320
    Points : 286
    Points
    286
    Par défaut
    Merci, mais avant que je me lance dans l'adaptation, est-ce que tu aurais une image de comment il se présente, stp ?

  6. #6
    Expert confirmé
    Avatar de le_chomeur
    Profil pro
    Développeur informatique
    Inscrit en
    Février 2006
    Messages
    3 653
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 3 653
    Points : 4 835
    Points
    4 835
    Par défaut
    Voila : mise en forme / couleurs modifiable en css
    Images attachées Images attachées  

  7. #7
    Membre actif Avatar de Zebulon777
    Homme Profil pro
    Informaticien
    Inscrit en
    Février 2005
    Messages
    1 320
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 57
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Informaticien

    Informations forums :
    Inscription : Février 2005
    Messages : 1 320
    Points : 286
    Points
    286
    Par défaut
    Merci, c'est super.
    Je tente l'intégration...
    A suivre...

Discussions similaires

  1. Modification de script
    Par tinoudu01 dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 12/06/2007, 13h42
  2. [eCommerce] Modification de scripts e-commerce
    Par DavidN90 dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 1
    Dernier message: 03/03/2007, 00h31
  3. script calendrier formulaire
    Par gforce dans le forum Bibliothèques et frameworks
    Réponses: 2
    Dernier message: 16/02/2007, 13h53
  4. script calendrier
    Par Dom_the_quaker dans le forum Développement Web en Java
    Réponses: 3
    Dernier message: 02/11/2005, 09h09
  5. Aide pour modification de script
    Par cryptorchild dans le forum Langage
    Réponses: 3
    Dernier message: 04/10/2005, 15h59

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