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 :

Selection d'une page en fonction du mois en cours


Sujet :

JavaScript

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 16
    Par défaut Selection d'une page en fonction du mois en cours
    Bonjour,

    Petite question de novice,

    Une page index avec le lien : 2011
    A la racine du site le fichier index puis une page htm pour chaque mois de l'année.

    Est-il possible de faire en sorte qu'en cliquant sur le lien 2011 de la page index,
    cela ouvre automatiquement la bonne page en fonction du mois en cours ?

    Merci d'avance,

    Julien

  2. #2
    Membre Expert
    Avatar de RomainVALERI
    Homme Profil pro
    POOête
    Inscrit en
    Avril 2008
    Messages
    2 652
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : POOête

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 652
    Par défaut
    Pour récupérer l'indice du mois en cours :
    Code javascript : Sélectionner tout - Visualiser dans une fenêtre à part
    var numero_du_mois = new Date().getMonth() + 1;
    Pourquoi "+ 1" ? parce qu'en JS, même si les numéros de jour commencent à 1, les mois, eux, sont numérotés de 0 à 11 ... va comprendre

    Après, avec ce numéro, tu devrais pouvoir t'en sortir pour "recoller les morceaux" avec les pages que tu veux lier... ^^

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 16
    Par défaut
    Bonjour RomainVALERI,

    Merci pour ta réponse, étant novice, puis-je te demander un peu plus de renseignements sur la manière de procéder ?

    Merci d'avance,

    Julin

  4. #4
    Membre Expert
    Avatar de RomainVALERI
    Homme Profil pro
    POOête
    Inscrit en
    Avril 2008
    Messages
    2 652
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : POOête

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 652
    Par défaut
    Pas de problème sur le pricnipe de donner un coup de main, mais il manque des éléments là ^^

    >>> quels sont les noms des pages ?

    >>> quel est leur emplacement par rapport a la page index (même répertoire ? sous-répertoire ?)

  5. #5
    Membre averti
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 16
    Par défaut
    Merci,

    A la base c'est pour une application Iphone.

    Le dossier :
    PLANNER

    Dedans :
    index.html

    janvier.html
    fevrier.html
    ........
    decembre.html

    Sur le fichier index.html, juste un lien "ENTRER" qui renvoi vers janvier.html (pour le moment).

    Je voudrais dans la mesure du possible, que à l'ouverture du site, cela me renvoi directement vers le mois en cours.

    Merci,

  6. #6
    Membre Expert
    Avatar de RomainVALERI
    Homme Profil pro
    POOête
    Inscrit en
    Avril 2008
    Messages
    2 652
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : POOête

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 652
    Par défaut
    Code javascript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    function redirigerSelonMois() {
       var numero = new Date().getMonth();
       var nomsDesMois = ["janvier", "fevrier", "mars", "avril", "mai", "juin", "juillet", "aout", "septembre", "octobre", "novembre", "decembre"];
       document.location.href = nomsDesMois[numero] + ".html";
    }

  7. #7
    Membre averti
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 16
    Par défaut
    Merci beaucoup votre aide,

    Je vais encore faire mon lourd, mais je dois mettre le code sur la page index ou sur toutes mes pages des mois. Dans la partie body ?

    Voici mon code, certainement pas très propre....

    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
    <html>
     
    <head> 
    <title>index</title>
    <meta name="viewport" content="user-scalable=no,width=device-width" />
     
    <meta name="LOULOU" content="IPHONE">
    <meta name="generator" content="Namo WebEditor v5.0">
    <script language="JavaScript">
    <!--
    function na_preload_img()
    { 
      var img_list = na_preload_img.arguments;
      if (document.preloadlist == null) 
        document.preloadlist = new Array();
      var top = document.preloadlist.length;
      for (var i=0; i < img_list.length; i++) {
        document.preloadlist[top+i] = new Image;
        document.preloadlist[top+i].src = img_list[i+1];
      } 
    }
     
    function na_change_img_src(name, nsdoc, rpath, preload)
    { 
      var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
      if (name == '')
        return;
      if (img) {
        img.altsrc = img.src;
        img.src    = rpath;
      } 
    }
     
    function na_restore_img_src(name, nsdoc)
    {
      var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
      if (name == '')
        return;
      if (img && img.altsrc) {
        img.src    = img.altsrc;
        img.altsrc = null;
      } 
    }
     
    // -->
    </script>
    </head>
     
    <body bgcolor="#151515" text="black" link="blue" vlink="purple" alink="red" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" OnLoad="na_preload_img(false, 'index_03_02.png');">
    <table border="0" cellpadding="0" cellspacing="0" width="320" height="444">
        <tr>
            <td width="320" height="421" align="center" valign="top" nowrap>
                <p><img src="index_01.png" width="319" height="384" border="0"><a href="janvier.html" OnMouseOut="na_restore_img_src('image1', 'document')" OnMouseOver="na_change_img_src('image1', 'document', 'index_03_02.png', true);"><img src="index_02.png" width="319" height="60" border="0" name="image1"></a></p>
            </td>
        </tr>
    </table>
     
    <p>
    </body>
     
    </html>
    Merci encore....

  8. #8
    Membre Expert
    Avatar de RomainVALERI
    Homme Profil pro
    POOête
    Inscrit en
    Avril 2008
    Messages
    2 652
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : POOête

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 652
    Par défaut
    Quelques remarques en vrac :

    - tu n'as pas de DOCTYPE au début de ta page HTML, pense à en rajouter un ^^ (pourquoi et comment ?)

    - la fonction de preload des images est spécifique à IE et ne fonctionnera pas sous les autres navigateurs (utilisation de "document.all")

    - l'attribut "langage" est déprécié, on ne l'utilise plus, tu peux remplacer tes balises script par :
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    <script type="text/javascript">...</script>

    En ce qui conerne ta question :
    Citation Envoyé par juni0r
    je dois mettre le code sur la page index ou sur toutes mes pages des mois. Dans la partie body ?
    Ca dépend de la navigation que tu veux obtenir...

    En appelant la fonction que je t'ai proposée directement sur ta page "index.html", le visiteur sera immédiatement redirigé vers la page du mois correspondant. Par contre, cela ne concerne en rien la navigation à partir de ces pages. Quels sont les choix de navigation que tu veux proposer aux visiteurs ?

  9. #9
    Membre averti
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 16
    Par défaut
    Merci pour tes conseils,

    En ce qui concerne la navigation, je voudrais donc tomber directement sur le mois en cours à partir du lien de la page index.

    Ensuite sur chaque page mensuelle se trouve un menu déroulant permettant la sélection de chaque mois.

    La page index :


    Janvier pour Exemple :


    Merci à toi encore et encore...

    J.

  10. #10
    Membre Expert
    Avatar de RomainVALERI
    Homme Profil pro
    POOête
    Inscrit en
    Avril 2008
    Messages
    2 652
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : POOête

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 652
    Par défaut
    Actuellement, pour faire ton bouton d'entrée, tu mets une image "dans" un lien <a>, mais ce n'est pas la meilleure solution, tu risques de t'emmeler les pinceaux

    Garde l'image mais supprime le lien autour, et place sur l'événement onclick de l'image la fonction que je t'ai écrite plus haut. (d'ailleurs le <p> qui les englobe, à mon avis, est inutile aussi ^^)

    Sur les pages des mois, place sur l'événement onchange de ton select une fonction un peu différente :
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <select onchange="voirMois(this);">
       <option value="Janvier" selected="selected">Janvier</option>
       <option value="Fevrier">Février</option>
       ...
    </select>
    et dans un script placé dans la balise head
    Code javascript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    function voirMois(sel) {
       document.location.href = sel[sel.selectedIndex].value + ".html";
    }
    Enfin dans les grandes lignes, hein... ^^

    Tiens-nous au jus

  11. #11
    Membre averti
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 16
    Par défaut
    Bonjour Romain,

    Merci pour ton aide,

    Voila : la page index.html :
    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
     
    <html>
    <head>
    <meta name="viewport" content="user-scalable=no,width=device-width" />
     
    <title>ACCUEIL</title>
     
    <meta name="generator" content="Namo WebEditor v5.0">
    </head>
    <body bgcolor="#151515" text="black" link="blue" vlink="purple" alink="red" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">
     
    <table border="0" cellpadding="0" cellspacing="0" width="320" height="444">
        <tr>
            <td width="320" height="444">
                <p><img src="index_03_01.png" align="top" width="319" height="384" border="0"></p>
                <form name="form2">
     
     
           <a href="janvier.html"><img src="index_03_02.png" width="319" height="60" border="0" onclick=function redirigerSelonMois() {
       var numero = new Date().getMonth();
       var nomsDesMois = [" janvier", "fevrier", "mars", "avril", "mai", "juin", "juillet", "aout", "septembre", "octobre", "novembre", "decembre"];
       document.location.href = nomsDesMois[numero] + ".html";
    ></a></p>
     
                </form>
            </td>
        </tr>
    </table>
    Et la page janvier.html :

    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
    <html>
     
    <head>
    <title>Sans titre</title>
    <meta name = "viewport" content = "user-scalable=no,width=device-width" />
    <title>JANVIER</title>
     
    <script language="JavaScript">
    <!--
    //MENU DEROULANT/
    function menuderoulant(selection){
    window.location=selection.options[selection.selectedIndex].value;
    }
    //-->
    </script>
    <meta name="generator" content="Namo WebEditor v5.0">
    <script type="text/javascript">function voirMois(sel) {
       document.location.href = sel[sel.selectedIndex].value + ".html";
    }</script>
    </head>
    <body bgcolor="#333333" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">
    <table border="0" cellpadding="0" cellspacing="0" width="307" height="20">
        <tr height="20">
            <td width="307" colspan="3">
                <p align="center"><img src="janvier.png" width="120" height="48" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="307" colspan="3" height="31">
       <form name="form1">
    <select onchange="voirMois(this);">
       <option value="Menu" selected=" selected">Menu</option>
       <option value="Janvier">Janvier</option>
       <option value="Fevrier">Février</option>
       <option value="Mars">Mars</option>
       <option value="Avril">Avril</option>
    </select>
    </form>
            </td>
        </tr>
        <tr height="20">
            <td width="307" colspan="3" height="9">
                <p>&nbsp;</p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="samedi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="1.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="repos.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="dimanche.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="2.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="repos.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="lundi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="3.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="mardi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="4.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="soir.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="mercredi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="5.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="soir.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="jeudi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="6.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="Vendredi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="7.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="soir.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="samedi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="8.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="repos.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="dimanche.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="9.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="repos.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="lundi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="10.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="mardi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="11.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="mercredi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="12.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="jeudi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="13.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="repos.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="Vendredi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="14.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="samedi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="15.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="dimanche.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="16.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="lundi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="17.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="repos.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="mardi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="18.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="mercredi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="19.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="jeudi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="20.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="Vendredi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="21.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="samedi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="22.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="repos.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="dimanche.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="23.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="repos.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="lundi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="24.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="soir.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="mardi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="25.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="mercredi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="26.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="jeudi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="27.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="repos.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="Vendredi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="28.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="samedi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="29.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="dimanche.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="30.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="matin.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="116" height="20">
                <p align="center"><font color="white"><img src="lundi.png" width="100" height="20" border="0"></font></p>
            </td>
            <td width="47" height="20" align="center" valign="middle">
                <p><img src="31.png" width="35" height="20" border="0"></p>
            </td>
            <td width="144" height="20">
                <p align="center"><img src="repos.png" width="132" height="20" border="0"></p>
            </td>
        </tr>
        <tr height="20">
            <td width="307" colspan="3" height="10">
                <p align="left">&nbsp;</p>
            </td>
        </tr>
        <tr height="20">
            <td width="307" colspan="3">
                <p align="center"><a href="index.html"><img src="retour.png" width="132" height="20" border="0"></a></p>
            </td>
        </tr>
    </table>
    <p>&nbsp;</p>
    </body>
    </html>
    J'ai du faire une erreur quelque part.... ^^

    Je mettrai au propre à la fin, le doctype etc.

    Merci

  12. #12
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 198
    Par défaut
    Bonjour,
    plusieurs erreurs...
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    var nomsDesMois = [" janvier"...
    pas d'espace entre " et janvier
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    onclick=function redirigerSelonMois() {
       var numero = new Date().getMonth();
       var nomsDesMois = [" janvier", "fevrier", "mars", "avril", "mai", "juin", "juillet", "aout
    c'est une déclaration des plus fantasque.

    Mets ta fonction entre des balises <script type="text/javascript"> et </script>
    et comme la dit
    Citation Envoyé par RomainVALERI
    Garde l'image mais supprime le lien autour, et place sur l'événement onclick de l'image la fonction que je t'ai écrite plus haut. (d'ailleurs le <p> qui les englobe, à mon avis, est inutile aussi ^^)
    supprimes le lien

  13. #13
    Membre Expert
    Avatar de RomainVALERI
    Homme Profil pro
    POOête
    Inscrit en
    Avril 2008
    Messages
    2 652
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : POOête

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 652
    Par défaut
    Citation Envoyé par juni0r Voir le message
    J'ai du faire une erreur quelque part.... ^^
    Une seule heureusement, mais une grosse. Elle se situe exactement ici :
    Citation Envoyé par juni0r Voir le message
    <meta name="generator" content="Namo WebEditor v5.0">
    ...car utiliser un éditeur WYSIWYG sans connaître les bases fondamentales des technologies sous-jacentes (notamment pour commencer : (x)html, javascript) est un choix qui me semble très périlleux ^^
    Citation Envoyé par juni0r Voir le message
    Je mettrai au propre à la fin, le doctype etc.
    Je t'assure que non, malheureusement.
    Tu n'en feras rien car :

    - ce sera particulièrement difficile étant donnée l'ampleur du carnage généré par cette usine à gaz application ()

    - une fois que ça marche, on se dit trop souvent ...bon ben d'accord je sais que ce n'est "pas trop propre" mais ça fait (à peu près) ce que je veux...

    Je suis prêt à t'aider mais avec un code généré aussi effrayant, dont les principales horreurs erreurs* () ne t'apparaissent pas immédiatement, ça risque d'être assez fastidieux...

    >>> Ne perds pas courage, révise un peu les bases, choisis/découvre/utilise un éditeur de code digne de ce nom, répare le plus gros, et reviens-nous voir

    * entre autres : mise en page par tableaux HTML, répétition ad nauseam des attributs (souvent dépréciés) de style, appel de la fonction sur le onclick défectueuse car elle est référencée au lieu d'être exécutée, et puis... *MAIS* qu'est-ce que c'est que ce <form> qui vient englober le lien ?

  14. #14
    Membre averti
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 16
    Par défaut
    ^^

    Merci à vous deux,

    Tu as entièrement raison, s'il faut le faire, autant le faire bien...

    Je reprend donc tout depuis le début avec les éléments de codes que vous m'avez donné.

    En revanche, quel type d'éditeur autre que namo puis-je utiliser ?

    Avec un visuel si possible....

    Merci,

    J.

  15. #15
    Membre averti
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    16
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 16
    Par défaut
    Bonsoir,

    Voila ce que j'ai pu obtenir,

    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
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="user-scalable=no,width=device-width" />
     
    <title>ACCUEIL</title>
     
    <script type="text/javascript">
    <img src="index_03_02.png" width="319" height="60" border="0" onclick="function redirigerSelonMois() {
    var numero = new Date().getMonth();
    var nomsDesMois = ["janvier", "fevrier", "mars", "avril", "mai", "juin", "juillet", "aout", "septembre", "octobre", "novembre", "decembre"];
    document.location.href = nomsDesMois[numero] + ".html";>
    </script>
     
    </head>
     
    <body bgcolor="#151515" text="black">
    <table border="0" cellpadding="0" cellspacing="0" width="320" height="444">
    <td width="320" height="444">
    <p><img src="index_03_01.png" align="top" width="319" height="384" border="0"><img src="index_03_02.png" width="319" height="60" border="0"></p>
    </table>
     
    </body>
     
    </html>
    J'ai passé un petit coup d'aspi dans ma page, hélas...encore des erreurs !!!

    Je dois me tromper dans le script, mais je sèche

    Merci,

    J.

  16. #16
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 198
    Par défaut
    toutes les recommandations n'ont pas été maitrisées et notamment
    Citation Envoyé par RomainVALERI
    * entre autres : mise en page par tableaux HTML, répétition ad nauseam des attributs (souvent dépréciés) de style, appel de la fonction sur le onclick défectueuse car elle est référencée au lieu d'être exécutée, et puis...
    et
    Mets ta fonction entre des balises <script type="text/javascript"> et </script>
    ce que tu as fait est un mix maladroit de l'ensemble

Discussions similaires

  1. [HTML 5] Selection d'une page en fonction du mois en cours
    Par juni0r dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 08/01/2011, 10h17
  2. Réponses: 1
    Dernier message: 04/04/2006, 11h29
  3. Bloquer l'accès à une page en fonction du navigateur
    Par 10-nice dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 30/08/2005, 15h29
  4. [débutant] modifier une page en fonction d'un menu
    Par Hastur dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 07/07/2005, 13h29
  5. selection sur une table en fonction de plusieurs ligne
    Par dimdidi dans le forum Langage SQL
    Réponses: 2
    Dernier message: 06/12/2004, 08h42

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