Partage
  • Partager sur Facebook
  • Partager sur Twitter

Help!! Menu vertical déroulant avec du Javascript - probleme lors de l'include

    13 octobre 2006 à 12:46:54

    Bonjour a tous,

    Alors j'ai un petit soucis d'ordre pratique....voir trés génant.
    J'ai tenté de realiser un menu déroulant vertical utilisant du Javascript.
    Le menu deroulant j'ai reussi.

    Mon problème est le suivant:
    j'ai donc mon menu (include dans index.php) qui quand on click dessus fait apparaitre des sous menu (qui déroule)qui eux meme appellent un Html qui est include juste a droite dans index.php

    Donc vu que les boutons du sous menu appellent un html en php include, cela fait recharger la page donc le menu revient dans sa forme initiale (non déroulé donc on ne voit pas les sous menu.) Ce qui fait au résultat qu'a chaque fois qu'une personne click sur un bouton de sous menu ben il devra reclicker sur le menu pour redérouler celui ci a fin d'acceder au sous menu.

    J'ai beaucoup de sous menu donc c'est plus un réel problème plutot qu'une gène.

    Donc, on m'a expliqué que pour résoudre ce problème fallait que je marque ma page en cours comme active dans le menu.
    Donc pour cela 2 methodes Php ou Js.

    On m'a fournit ce lien :
    http://www.fastclemmy.com/index.php?viewlog=98_vous-etes-ici

    J'ai essayé de comprendre et de le refaire mais impossible...(Je suis un novice. Est ce que quelqu'un pourrait m'aider a éplucher tout ca, et l'adapter sur mon menu ?
    Merci vraiment de votre aide

    Voici mes codes de mes pages (Menu.htm, index.php, style.css)

    Citation : index.php


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title></title>
    <style type="text/css">
    <!--
    body {
    background-color: #000000;
    }
    .Style4 {color: #FF0000}
    .Style5 {font-family: Arial, Helvetica, sans-serif}
    .Style6 {font-size: 10px}
    .Style9 {
    font-size: 10px;
    font-family: Arial, Helvetica, sans-serif;
    color: #FF0000;
    }
    .Titre {font-family: Arial, Helvetica, sans-serif; font-size: 10px;}
    .Style11 {color: #9D0000}
    .Style22 {font-size: 16}
    -->
    </style>
    <link href="style.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    .Style24 {
    color: #666666;
    font-weight: bold;
    }
    .Style25 {color: #FFFFFF}
    .Style26 {
    color: #666666;
    font-family: Tahoma;
    }
    -->
    </style>
    </head>

    <body>
    <table width="836" border="0" cellpadding="0" cellspacing="0" class="block">
    <!--DWLayoutTable-->
    <tr>
    <td width="20" height="5"></td>
    <td width="797"></td>
    <td width="19"></td>
    </tr>
    <tr>
    <td height="465"></td>
    <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
    <!--DWLayoutTable-->
    <tr>
    <td height="14" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="292627">
    <!--DWLayoutTable-->
    <tr>
    <td width="797" height="14" valign="top" bgcolor="#292627" class="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td width="200" height="451" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#9d9694">
    <!--DWLayoutTable-->
    <tr>
    <td width="186" height="451" valign="top">

    <div class="menu" align="left">
    <?php
    include("menu.htm");
    ?>
    </div></td>
    <td width="14" valign="top"><div align="right"></div></td>
    </tr>
    </table></td>
    <td width="597" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->
    <tr>
    <td width="597" height="451" align="left" valign="top" class="Style22">

    <div class="frame" align="left">
    <?php
    if (!isset($_GET['page'])) $page= 'conteneur'; else $page= $_GET['page'];
    switch($page)
    {
    /*Menu gauche*/
    case 'menu': include ('menu.htm');break;

    }
    ?>
    </div>
    <div align="left"></div></td>
    </tr>
    </table></td>
    </tr>
    </table></td>
    <td></td>
    </tr>
    <tr>
    <td height="14"></td>
    <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#292627">
    <!--DWLayoutTable-->
    <tr>
    <td width="797" height="14"></td>
    </tr>
    </table></td>
    <td></td>
    </tr>
    <tr>
    <td height="54"></td>
    <td>&nbsp;</td>
    <td></td>
    </tr>
    </table>
    </div>
    </body>
    </html>



    Citation : menu.htm

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <script type="text/javascript" src="menu.js"></script>
    <script type="text/javascript"><!--
    document.write('<'+'style type="text/css" media="screen, projection"><!--');
    document.write('dl#menu dd { display: none; }');
    document.write('--><'+'/style>');
    //--></script>

    <script type="text/javascript">
    <!--
    window.onload=montre;
    function montre(id) {
    var d = document.getElementById(id);
    for (var i = 1; i<=10; i++) {
    if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
    }
    if (d) {d.style.display='block';}
    }
    //-->
    </script>

    <title>Document sans nom</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="style.css" rel="stylesheet" type="text/css">
    </head>

    <body>
    <dl id="menu" name="nav">

    <dt onclick="javascript:montre();"><a href="#"><strong>Browse by Category</strong></a></dt>

    <dt onclick="javascript:montre('smenu1');">&gt;Menu2</dt>

    <dd id="smenu1">
    <ul>
    <li><a href="#">item1</a></li>
    <li><a href="#">item2</a></li>
    <li><a href="#">item3</a></li>
    <li><a href="#">item4</a></li>
    </ul><br>
    </dd>

    <dt onclick="javascript:montre('smenu2');">&gt;Menu2</dt>

    <dd id="smenu2">
    <ul>
    <li><a href="#">item1</a></li>
    <li><a href="#">item2</a></li>
    </ul>
    </dd>
    </dl>

    </body>
    </html>



    Citation : style.css

    /* CSS Document */
    <style type="text/css" media="screen">

    body {
    margin: 0;
    padding: 0;
    font-family:Arial, Helvetica, sans-serif;
    font-size:10px;
    background-color:#9d9694;
    }
    dl, dt, dd, ul, li {
    margin: 0;
    padding: 0;
    list-style-type: none;
    }
    #menu {
    position:relative;
    top: 0;
    left: 0;
    font-family:Arial, Helvetica, sans-serif;
    width: 15em;
    background-color:#9d9694;
    }
    #menu {
    }
    /* Modifications sur Grand titre */
    #menu dt {
    cursor: pointer;
    font-family:Arial, Helvetica, sans-serif;
    font-size:11px;
    color:#333333;
    font-weight: none;
    background: #9d9694; /* Modifications couleur background Grand titre */
    }
    #menu dd {
    font-family:Arial, Helvetica, sans-serif;
    }
    /* Modification sous menu */
    #menu li {
    font-family:arial;
    line-height: 15px;
    font-size:11px;
    margin-left: 25px;
    color:#333333;
    text-decoration:none;
    background-color:#9d9694;
    }
    #menu li a, #menu dt a {
    color: #333333; /* Modifications couleur texte sous menu */
    text-decoration: none;
    height: 100%;
    }
    #menu li a:hover, #menu dt a:hover {
    background: none;
    }
    .menu{
    margin-left: 20px;
    background-color:#9d9694;

    }
    .frame{
    margin-left: 0px;
    margin-top: 20px;
    }
    .t3{
    font-family:arial;
    color:#333333;
    font-size:11px;
    text-decoration:underline
    }
    .t4{
    font-family:arial;
    color:#666666;
    font-size:11px;
    text-decoration:underline
    }

    </style>

    • Partager sur Facebook
    • Partager sur Twitter

    Help!! Menu vertical déroulant avec du Javascript - probleme lors de l'include

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown