[javascript] code afficher disparaitre

code afficher disparaitre [javascript] - HTML/CSS - Programmation

Marsh Posté le 09-04-2005 à 13:45:01    

Bonjour,
 
j'ai récupéré ce script (voir ci-dessous) (merci à l'auteur) (Menu avec affichage ou non du sous menu)
 
Sous internet explorer : marche bien (mais le pb c que avec le sp2 ou autre mis à jour, le javascript est bloqué :-/  
faut cliquer pour le débloquer... c chiant ça.
Avec firefox, ça ne marche pas(tout est affiché par défaut)
 
J'arrive avec la fonction visibility mais c'est pas ça que je veux, car ce qui a en dessous remonte pas dans ce cas la....  
 
Pouvez vous m'aider pour trouver quelque chose qui marche de ce meme style?  
valable pour firefox?
merci !
 

Code :
  1. <html>
  2. <head>
  3. <title>Menu dHTML</title>
  4. <meta name="author" content="Christophe">
  5. <script language=JScript>
  6. function ShowHide(Div) {
  7.    if (Div.style.display=='none') {
  8.      Div.style.display='InLine';
  9.     }
  10.     else {
  11.      Div.style.display='none';
  12.     }
  13.   }
  14. </script>
  15. </head>
  16. <body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
  17. <table style="border-top-width:1px; border-right-width:1px; border-bottom-width:0px; border-left-width:1px; border-color:rgb(153,153,153); border-top-style:solid; border-right-style:solid; border-bottom-style:none; border-left-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#CCCCCC" bordercolordark="white" bordercolorlight="black">
  18.     <tr>
  19.         <td width="150">
  20.             <p style="line-height:100%; margin-top:0; margin-bottom:0;">titre
  21.             <a href="#" OnClick="javascript: ShowHide(menu1);">menu 1</a></p>
  22.         </td>
  23.     </tr>
  24. </table>
  25. <DIV id='menu1' style=display=InLine;>
  26. <table style="line-height:100%; margin-top:0; margin-bottom:0; border-top-width:1px; border-right-width:1px; border-bottom-width:0px; border-left-width:1px; border-color:rgb(153,153,153); border-top-style:solid; border-right-style:solid; border-bottom-style:none; border-left-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#F9F9F9">
  27.     <tr>
  28.         <td width="150" style="border-bottom-width:1px; border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
  29.             <p style="line-height:100%; margin-top:0; margin-bottom:0; margin-left:20;">sous menu 1</p>
  30.         </td>
  31.     </tr>
  32.     <tr>
  33.         <td width="150" style="border-bottom-width:1px; border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
  34.             <p style="line-height:100%; margin-top:0; margin-bottom:0; margin-left:20;">sous menu 2</p>
  35.         </td>
  36.     </tr>
  37.     <tr>
  38.         <td width="150">
  39.             <p style="line-height:100%; margin-top:0; margin-bottom:0; margin-left:20;">sous menu 3</p>
  40.         </td>
  41.     </tr>
  42. </table>
  43. </div>
  44. <table style="border-width:1px; border-color:rgb(153,153,153); border-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#CCCCCC" bordercolordark="white" bordercolorlight="black">
  45.     <tr>
  46.         <td width="150">
  47.             <p style="line-height:100%; margin-top:0; margin-bottom:0;">titre
  48.             <a href="#" OnClick="javascript: ShowHide(menu2);">menu 2</a></p>
  49.         </td>
  50.     </tr>
  51. </table>
  52. <DIV id='menu2' style=display=none;>
  53. <table style="line-height:100%; margin-top:0; margin-bottom:0; border-top-width:0px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-color:rgb(153,153,153); border-top-style:none; border-right-style:solid; border-bottom-style:solid; border-left-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#F9F9F9">
  54.     <tr>
  55.         <td width="150" style="border-bottom-width:1px; border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
  56.             <p style="line-height:100%; margin-top:0; margin-bottom:0; margin-left:20;">sous menu 1</p>
  57.         </td>
  58.     </tr>
  59.     <tr>
  60.         <td width="150" style="border-bottom-width:1px; border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
  61.             <p style="line-height:100%; margin-top:0; margin-bottom:0; margin-left:20;">sous menu 2</p>
  62.         </td>
  63.     </tr>
  64.     <tr>
  65.         <td width="150">
  66.             <p style="line-height:100%; margin-top:0; margin-bottom:0; margin-left:20;">sous menu 3</p>
  67.         </td>
  68.     </tr>
  69. </table>
  70. </div>
  71. <table style="border-top-width:0px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-color:rgb(153,153,153); border-top-style:none; border-right-style:solid; border-bottom-style:solid; border-left-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#CCCCCC" bordercolordark="white" bordercolorlight="black">
  72.     <tr>
  73.         <td width="150">
  74.             <p style="line-height:100%; margin-top:0; margin-bottom:0;">titre
  75.             <a href="#" OnClick="javascript: ShowHide(menu3);">menu 3</a></p>
  76.         </td>
  77.     </tr>
  78. </table>
  79. <DIV id='menu3' style=display=none;>
  80. <table style="line-height:100%; margin-top:0; margin-bottom:0; border-top-width:0px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-color:rgb(153,153,153); border-top-style:none; border-right-style:solid; border-bottom-style:solid; border-left-style:solid;" cellpadding="5" cellspacing="0" bgcolor="#F9F9F9">
  81.     <tr>
  82.         <td width="150" style="border-bottom-width:1px; border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
  83.             <p style="line-height:100%; margin-top:0; margin-bottom:0; margin-left:20;">sous menu 1</p>
  84.         </td>
  85.     </tr>
  86.     <tr>
  87.         <td width="150" style="border-bottom-width:1px; border-bottom-color:rgb(153,153,153); border-bottom-style:solid;">
  88.             <p style="line-height:100%; margin-top:0; margin-bottom:0; margin-left:20;">sous menu 2</p>
  89.         </td>
  90.     </tr>
  91.     <tr>
  92.         <td width="150">
  93.             <p style="line-height:100%; margin-top:0; margin-bottom:0; margin-left:20;">sous menu 3</p>
  94.         </td>
  95.     </tr>
  96. </table>
  97. <p>&nbsp;</p>
  98. <p>&nbsp;</p>
  99. </div>
  100. </body>
  101. </html>

Reply

Marsh Posté le 09-04-2005 à 13:45:01   

Reply

Marsh Posté le 09-04-2005 à 14:25:25    

Désolé, ici on fait du développement, pas du maintient de scripts à la con récupérés à gauche ou à droite.
 
Si tu veux de l'aide là dessus, c'est à l'auteur qu'il faut demander :hello:


---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box, and replicate and expand beyond their wildest dreams by throwing away the limits imposed by overbearing genetic r
Reply

Marsh Posté le 09-04-2005 à 14:50:09    

+1  
 
Sinon pour faire apparaitre / disparaitre quelque chose :
 
document.getElementById('id_du_truc_qui_apparait_disparait').style.display = "none"; (disparait) et = "block"; (apparait)

Reply

Marsh Posté le 09-04-2005 à 16:41:24    

C'est à dire que j'ai essayé de créer le script mais je n'arrive pas sous firefox.
j'ai mis juste un exemple de ce que je voulais faire.
 
sous internet explorer, j'y arrive..
(merci Hermes le Messager)
 
mais sous firefox, le script ne marche pas...
Firefox est de plus en plus utilisé donc il faut quelque chose qui fonctionne avec celui-ci...
 

Reply

Marsh Posté le 09-04-2005 à 22:42:02    

En d'autres termes, comment utiliser ce script  

Code :
  1. document.getElementById('id_du_truc_qui_apparait_disparait').style.display = "none"; (disparait) et = "block"; (apparait)


sous firefox
 
ps: en plus, ça n'est pas du tout un truc comme ça que je veux faire!  
ça doit etre récursif....  
c'est pour faire un genre d'explorer sur la gauche.

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed