Menu JS qui ne marche pas avec IE

Menu JS qui ne marche pas avec IE - HTML/CSS - Programmation

Marsh Posté le 21-11-2007 à 18:46:58    

Bonjour,
j'ai fait un menu (copié je ne sais plus où) mais il ne fonctionne qu'avec firefox.
Voici le code:

Code :
  1. <DIV class=menu id=wrap align=left>
  2. <TABLE class=menu id=menu cellSpacing=0 cellPadding=5 width="100%" name="menu">
  3. <TBODY>
  4. <TR>
  5. <TD><A id=menu0 href="index.html"><B>Accueil</A></B></TD></TR>
  6. <TR>
  7. <TD><A id=menu11 href="javascript:void(0)"><B>Les Sports&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<IMG height=17 src="fleche.gif" width=38 align=top border=0></A></B></TD></TR>
  8. <TR>
  9. <TD><A id=menu1 href="javascript:void(0)"><B>L'art&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<IMG height=17 src="fleche.gif" width=38 align=top border=0></A></B></TD></TR>
  10. <TR>
  11. <TD><A id=menu20 href="javascript:void(0)"><B>Char de la St Jean</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<IMG height=17 src="fleche.gif" width=38 align=top border=0></A></TD></TR></TBODY></TABLE></DIV>
  12. <DIV id=subwrap>
  13. <SCRIPT type=text/javascript>
  14. <!--
  15. if (TransMenu.isSupported()) {
  16. var ms = new TransMenuSet(TransMenu.direction.right, 5, -2, TransMenu.reference.topRight);
  17. var menu0 = ms.addMenu(document.getElementById("menu0" ));
  18. var menu11 = ms.addMenu(document.getElementById("menu11" ));
  19. menu11.addItem("BADMINTON", "badminton.html", "0" );
  20. menu11.addItem("BASKET", "basket.html", "0" );
  21. menu11.addItem("CYCLO", "cyclo.html", "0" );
  22. menu11.addItem("DANSE Hip-Hop", "hiphop.html", "0" );
  23. menu11.addItem("DANSE", "danse.html", "0" );
  24. menu11.addItem("GYM ENTRETIEN MATIN", "gymmatin.html", "0" );
  25. menu11.addItem("GYM ENTRETIEN SOIR", "gymsoir.html", "0" );
  26. menu11.addItem("GYM TONY'C", "gymtonyc.html", "0" );
  27. menu11.addItem("JUDO", "judo.html", "0" );
  28. menu11.addItem("MUSCULATION", "musculation.html", "0" );
  29. menu11.addItem("TENNIS DE TABLE", "tennisdetable.html", "0" );
  30. var menu1 = ms.addMenu(document.getElementById("menu1" ));
  31. menu1.addItem("ARTS PLASTIQUES", "artsplastiques.html", "0" );
  32. var menu3 = menu1.addMenu(menu1.items[0],0,0);
  33. menu1.addItem("COUTURE", "couture.html", "0" );
  34. var menu20 = ms.addMenu(document.getElementById("menu20" ));
  35. menu20.addItem("CHAR", "char.html", "0" );
  36. function init() {
  37. if (TransMenu.isSupported()) {
  38. TransMenu.initialize();
  39. menu0.onactivate = function() {document.getElementById("menu0" ).className = "hover"; };
  40. menu0.ondeactivate = function() {document.getElementById("menu0" ).className = ""; };
  41. menu11.onactivate = function() {document.getElementById("menu11" ).className = "hover"; };
  42. menu11.ondeactivate = function() {document.getElementById("menu11" ).className = ""; };
  43. menu1.onactivate = function() {document.getElementById("menu1" ).className = "hover"; };
  44. menu1.ondeactivate = function() {document.getElementById("menu1" ).className = ""; };
  45. menu20.onactivate = function() {document.getElementById("menu20" ).className = "hover"; };
  46. menu20.ondeactivate = function() {document.getElementById("menu20" ).className = ""; };
  47. }}
  48. TransMenu.dingbatSize = 0;
  49. TransMenu.spacerGif = "";
  50. TransMenu.dingbatOn = "";
  51. TransMenu.dingbatOff = "";
  52. TransMenu.sub_indicator = false;
  53. TransMenu.menuPadding = 15;
  54. TransMenu.itemPadding = 15;
  55. TransMenu.shadowSize = 2;
  56. TransMenu.shadowOffset = 3;
  57. TransMenu.shadowColor = "#888";
  58. TransMenu.shadowPng = "http://www.swmenu.com/modules/mod_swmenufree/images/transmenu/grey-40.png";
  59. TransMenu.backgroundColor = "#FFCC99";
  60. TransMenu.backgroundPng = "http://www.swmenu.com/modules/mod_swmenufree/images/transmenu/white-90.png";
  61. TransMenu.hideDelay = 600;
  62. TransMenu.slideTime = 300;
  63. TransMenu.selecthack =1;
  64. TransMenu.renderAll();
  65. if ( typeof window.addEventListener != "undefined" )
  66. window.addEventListener( "load", init, false );
  67. else if ( typeof window.attachEvent != "undefined" ) {
  68. window.attachEvent( "onload", init);
  69. }else{
  70. if ( window.onload != null ) {
  71. var oldOnload = window.onload;
  72. window.onload = function ( e ) {
  73. oldOnload( e );
  74. init();
  75. }
  76. }else
  77. window.onload = init();
  78. }
  79. }
  80. -->
  81. </SCRIPT>
  82. <DIV class="transMenu top" id=TransMenu0 style="VISIBILITY: hidden; WIDTH: 4px; HEIGHT: 4px">
  83. <DIV class=content style="LEFT: -4px; WIDTH: 2px; HEIGHT: 2px">
  84. <TABLE class=items cellSpacing=0 cellPadding=0 border=0>
  85. <TBODY></TBODY></TABLE>
  86. <DIV class=shadowBottom><IMG height=1 src="" width=1></DIV>
  87. <DIV class=shadowRight style="LEFT: 0px"><IMG height=1 src="" width=1></DIV>
  88. <DIV class=background style="WIDTH: 0px; HEIGHT: 0px; BACKGROUND-COLOR: #ffcc99"><IMG height=1 src="" width=1></DIV></DIV></DIV>
  89. <DIV class="transMenu top" id=TransMenu1>
  90. <DIV class=content>
  91. <TABLE class=items cellSpacing=0 cellPadding=0 border=0>
  92. <TBODY>
  93. <TR class=item>
  94. <TD id=TransMenu1-0 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>BADMINTON</TD></TR>
  95. <TR class=item>
  96. <TD id=TransMenu1-1 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>BASKET</TD></TR>
  97. <TR class=item>
  98. <TD id=TransMenu1-2 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>CYCLO</TD></TR>
  99. <TR class=item>
  100. <TD id=TransMenu1-3 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>DANSE Hip-Hop</TD></TR>
  101. <TR class=item>
  102. <TD id=TransMenu1-4 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>DANSE</TD></TR>
  103. <TR class=item>
  104. <TD id=TransMenu1-5 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>GYM ENTRETIEN MATIN</TD></TR>
  105. <TR class=item>
  106. <TD id=TransMenu1-6 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>GYM ENTRETIEN SOIR</TD></TR>
  107. <TR class=item>
  108. <TD id=TransMenu1-7 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>GYM TONY'C</TD></TR>
  109. <TR class=item>
  110. <TD id=TransMenu1-8 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>JUDO</TD></TR>
  111. <TR class=item>
  112. <TD id=TransMenu1-9 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>MUSCULATION</TD></TR>
  113. <TR class=item>
  114. <TD id=TransMenu1-10 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>TENNIS DE TABLE</TD></TR></TBODY></TABLE>
  115. <DIV class=shadowBottom><IMG height=1 src="" width=1></DIV>
  116. <DIV class=shadowRight><IMG height=1 src="" width=1></DIV>
  117. <DIV class=background><IMG height=1 src="" width=1></DIV></DIV></DIV>
  118. <DIV class="transMenu top" id=TransMenu2>
  119. <DIV class=content>
  120. <TABLE class=items cellSpacing=0 cellPadding=0 border=0>
  121. <TBODY>
  122. <TR class=item>
  123. <TD id=TransMenu2-0 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>ARTS PLASTIQUES</TD></TR>
  124. <TR class=item>
  125. <TD id=TransMenu2-1 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>COUTURE</TD></TR></TBODY></TABLE>
  126. <DIV class=shadowBottom><IMG height=1 src="" width=1></DIV>
  127. <DIV class=shadowRight><IMG height=1 src="" width=1></DIV>
  128. <DIV class=background><IMG height=1 src="" width=1></DIV></DIV></DIV>
  129. <DIV class=transMenu id=TransMenu3>
  130. <DIV class=content>
  131. <TABLE class=items cellSpacing=0 cellPadding=0 border=0>
  132. <TBODY></TBODY></TABLE>
  133. <DIV class=shadowBottom><IMG height=1 src="" width=1></DIV>
  134. <DIV class=shadowRight><IMG height=1 src="" width=1></DIV>
  135. <DIV class=background><IMG height=1 src="" width=1></DIV></DIV></DIV>
  136. <DIV class="transMenu top" id=TransMenu4>
  137. <DIV class=content>
  138. <TABLE class=items cellSpacing=0 cellPadding=0 border=0>
  139. <TBODY>
  140. <TR class=item>
  141. <TD id=TransMenu4-0 style="PADDING-RIGHT: 15px; PADDING-LEFT: 30px; PADDING-BOTTOM: 15px; PADDING-TOP: 15px" noWrap>CHAR</TD></TR></TBODY></TABLE>
  142. <DIV class=shadowBottom><IMG height=1 src="" width=1></DIV>
  143. <DIV class=shadowRight><IMG height=1 src="" width=1></DIV>
  144. <DIV class=background><IMG height=1 src="" width=1></DIV></DIV>


Et le style correspondant :  
 

Code :
  1. <STYLE type=text/css>
  2. <!--
  3. .transMenu {
  4. position:absolute ;
  5. overflow:hidden;
  6. left:-1000px;
  7. top:-1000px;
  8. }
  9. .transMenu .content {
  10. position:absolute;
  11. }
  12. .transMenu .items {
  13. border: 0px solid #FFFFFF ;
  14. position:relative ;
  15. left:0px; top:0px;
  16. z-index:2;
  17. }
  18. .transMenu  td
  19. {
  20. padding: 5px 5px 5px 5px; 
  21. font-size: 12px;
  22. font-family: Arial, Helvetica, sans-serif;
  23. text-align: left;
  24. font-weight: bold;
  25. color: #000000;
  26. }
  27. #subwrap
  28. {
  29. text-align: left ;
  30. }
  31. .transMenu  .item.hover td
  32. color: #FFFFFF;
  33. }
  34. .transMenu .item td{
  35. border:2px solid #666666;
  36. border-style:ridge;
  37. text-decoration: none ;
  38. cursor:pointer;
  39. cursor:hand;
  40. }
  41. .transMenu .background {
  42. background-color: #FFCC99;
  43. position:absolute ;
  44. left:0px; top:0px;
  45. z-index:1;
  46. -moz-opacity:0.85;
  47. filter:alpha(opacity=85);
  48. }
  49. .transMenu .shadowRight {
  50. position:absolute ;
  51. z-index:3;
  52. top:-3000px; width:2px;
  53. -moz-opacity:0.85;
  54. filter:alpha(opacity=85)
  55. }
  56. .transMenu .shadowBottom {
  57. position:absolute ;
  58. z-index:1;
  59. left:-3000px; height:2px;
  60. -moz-opacity:0.85;
  61. filter:alpha(opacity=85)
  62. }
  63. .transMenu .item.hover {
  64. background-color: #FF6600;
  65. }
  66. .transMenu .item img {
  67. margin-left:10px;
  68. }
  69. table.menu {
  70. top: 0px;
  71. left: 0px;
  72. position:relative;
  73. margin:0px;
  74. border: 0px;
  75. z-index: 1;
  76. }
  77. table.menu a{
  78. margin:0px;
  79. padding: 5px 5px 5px 5px;
  80. display:block;
  81. position:relative;
  82. border:2px solid #666666; 
  83. }
  84. div.menu a,
  85. div.menu a:visited,
  86. div.menu a:link {
  87. font:bold;
  88. font-size: 16px;
  89. font-family: Arial, Helvetica, sans-serif;
  90. text-align: left; 
  91. color: #FF9933;
  92. text-decoration: none;
  93. margin-bottom:0px;
  94. display:block;
  95. white-space:nowrap ;
  96. }
  97. div.menu td {
  98. border-right: 2px solid #666666 ;
  99. border-top: 2px solid #666666 ;
  100. border-left: 2px solid #666666 ;
  101. background-color: #FFFFFF;
  102. border-bottom: 2px solid #666666 ; 
  103. }
  104. div.menu td.last {
  105. }
  106. #trans-active a{
  107. color: #FFFFFF;
  108. background-color: #33CCFF;
  109. }
  110. #menu a.hover   {
  111. color: #FFFFFF;
  112. background-color: #33CCFF;
  113. }
  114. #menu span {
  115. display:none;
  116. }
  117. body {
  118. background-color: #FF9966;
  119. }
  120. -->
  121. </STYLE>


 
désolé pour la présentation mais je suis sous un poste de l'université n'ayant que IE donc c'est la merde pour récupérer le code. bref
 
Vous pouvez trouver la page sur http://cuhbe.free.fr/site%20FJEPS/test.html
 
Si quelqu'un sait ce que je doit changer pour que le menu fonctionne sous IE ainsi que firefox , merci de me le dire par avance :)
 
Bye.

Reply

Marsh Posté le 21-11-2007 à 18:46:58   

Reply

Marsh Posté le 21-11-2007 à 19:33:33    

je connais pas onactivate / ondeactivate
essaie avec onmouseover onmouseout


---------------
« The enemy is the gramophone mind, whether or not one agrees with the record that is being played at the moment. » — George Orwell
Reply

Marsh Posté le 22-11-2007 à 10:31:16    

je recommande de jeter ce menu à la poubelle

Reply

Marsh Posté le 22-11-2007 à 12:46:53    

s'il fallait jeter un truc c est la page entière hein
mais comme c etait pas trop constructif j ai préféré l'être un peu plus [:dockbchris]


Message édité par mIRROR le 22-11-2007 à 12:47:09

---------------
« The enemy is the gramophone mind, whether or not one agrees with the record that is being played at the moment. » — George Orwell
Reply

Marsh Posté le 29-11-2007 à 23:21:14    

lol
 
ok
 
des conseils sinon ?
autre que de tout jeter. Genre pour faire un beau menu pratique, et pas moche.
 
Merci.

Reply

Sujets relatifs:

Leave a Replay

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