pb de modification de script javascript

pb de modification de script javascript - HTML/CSS - Programmation

Marsh Posté le 11-11-2004 à 23:22:14    

bonjour j'ai le script suivant:
 

Code :
  1. Entre <HEAD> et </HEAD>:
  2. <style type="text/css">
  3. body             {background-color:#ffffff;}
  4. #divMenu a       {color:#999999; text-decoration:underline;}
  5. #divMenu a:hover {color:#333333; text-decoration:underline;}
  6. #divBg           {position:absolute; z-index:10; width:2000px; left:0px; height:100px; clip:rect(0px 10px 10px 0px); visibility:hidden;}
  7. #divMenu         {position:absolute; z-index:11; left:11px; top:1px; color:#333333; font-size:13px; font-family:verdana,arial,helvetica,sans-serif; visibility:inherit;}
  8. #divArrowLeft    {position:absolute; z-index:12; width:11px; height:20px; left:0px; top:0px; visibility:inherit;}
  9. #divArrowRight   {position:absolute; z-index:12; width:11px; height:20px; top:0px; visibility:inherit;}
  10. </style>
  11. <script language="JavaScript" type="text/javascript">
  12. /**********************************************************************************   
  13. SideScrollMenu  
  14. *   Copyright (C) 2001 Thomas Brattli
  15. *   This script was released at DHTMLCentral.com
  16. *   Visit for more great scripts!
  17. *   This may be used and changed freely as long as this msg is intact!
  18. *   We will also appreciate any links you could give us.
  19. *
  20. *   Made by Thomas Brattliand modified byMichael van Ouwerkerk
  21. *
  22. *   Script date: 09/07/2001 (keep this date to check versions)  
  23. *********************************************************************************/
  24. //Script téléchargé sur EasyScript (www.easy-script.com)
  25. function lib_bwcheck(){ //Browsercheck (needed)
  26. this.ver=navigator.appVersion
  27. this.agent=navigator.userAgent
  28. this.dom=document.getElementById?1:0
  29. this.opera5=(navigator.userAgent.indexOf("Opera" )>-1 && document.getElementById)?1:0
  30. this.ie5=(this.ver.indexOf("MSIE 5" )>-1 && this.dom && !this.opera5)?1:0;
  31. this.ie6=(this.ver.indexOf("MSIE 6" )>-1 && this.dom && !this.opera5)?1:0;
  32. this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
  33. this.ie=this.ie4||this.ie5||this.ie6
  34. this.mac=this.agent.indexOf("Mac" )>-1
  35. this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
  36. this.ns4=(document.layers && !this.dom)?1:0;
  37. this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
  38. return this
  39. }
  40. var bw=lib_bwcheck()
  41. /**************************************************************************
  42. Variables to set.
  43. ***************************************************************************/
  44. sLeft = 0         //The left placement of the menu
  45. sTop = 120        //The top placement of the menu
  46. sMenuheight = 30  //The height of the menu
  47. sArrowwidth = 11  //Width of the arrows
  48. sScrollspeed = 20 //Scroll speed: (in milliseconds, change this one and the next variable to change the speed)
  49. sScrollPx = 8     //Pixels to scroll per timeout.
  50. sScrollExtra = 15 //Extra speed to scroll onmousedown (pixels)
  51. /**************************************************************************
  52. Scrolling functions
  53. ***************************************************************************/
  54. var tim = 0
  55. var noScroll = true
  56. function mLeft(){
  57. if (!noScroll && oMenu.x<sArrowwidth){
  58.  oMenu.moveBy(sScrollPx,0)
  59.  tim = setTimeout("mLeft()",sScrollspeed)
  60. }
  61. }
  62. function mRight(){
  63. if (!noScroll && oMenu.x>-(oMenu.scrollWidth-(pageWidth))-sArrowwidth){
  64.  oMenu.moveBy(-sScrollPx,0)
  65.  tim = setTimeout("mRight()",sScrollspeed)
  66. }
  67. }
  68. function noMove(){
  69. clearTimeout(tim);
  70. noScroll = true;
  71. sScrollPx = sScrollPxOriginal;
  72. }
  73. /**************************************************************************
  74. Object part
  75. ***************************************************************************/
  76. function makeObj(obj,nest,menu){
  77. nest = (!nest) ? "":'document.'+nest+'.';
  78. this.elm = bw.ns4?eval(nest+"document.layers." +obj):bw.ie4?document.all[obj]:document.getElementById(obj);
  79.     this.css = bw.ns4?this.elm:this.elm.style;
  80. this.scrollWidth = bw.ns4?this.css.document.width:this.elm.offsetWidth;
  81. this.x = bw.ns4?this.css.left:this.elm.offsetLeft;
  82. this.y = bw.ns4?this.css.top:this.elm.offsetTop;
  83. this.moveBy = b_moveBy;
  84. this.moveIt = b_moveIt;
  85. this.clipTo = b_clipTo;
  86. return this;
  87. }
  88. var px = bw.ns4||window.opera?"":"px";
  89. function b_moveIt(x,y){
  90. if (x!=null){this.x=x; this.css.left=this.x+px;}
  91. if (y!=null){this.y=y; this.css.top=this.y+px;}
  92. }
  93. function b_moveBy(x,y){this.x=this.x+x; this.y=this.y+y; this.css.left=this.x+px; this.css.top=this.y+px;}
  94. function b_clipTo(t,r,b,l){
  95. if(bw.ns4){this.css.clip.top=t; this.css.clip.right=r; this.css.clip.bottom=b; this.css.clip.left=l;}
  96. else this.css.clip="rect("+t+"px "+r+"px "+b+"px "+l+"px)";
  97. }
  98. /**************************************************************************
  99. Object part end
  100. ***************************************************************************/
  101. /**************************************************************************
  102. Init function. Set the placements of the objects here.
  103. ***************************************************************************/
  104. var sScrollPxOriginal = sScrollPx;
  105. function sideInit(){
  106. //Width of the menu, Currently set to the width of the document.
  107. //If you want the menu to be 500px wide for instance, just  
  108. //set the pageWidth=500 in stead.
  109. pageWidth = (bw.ns4 || bw.ns6 || window.opera)?innerWidth:document.body.clientWidth;
  110. //Making the objects...
  111. oBg = new makeObj('divBg')
  112. oMenu = new makeObj('divMenu','divBg',1)
  113. oArrowRight = new makeObj('divArrowRight','divBg')
  114. //Placing the menucontainer, the layer with links, and the right arrow.
  115. oBg.moveIt(sLeft,sTop) //Main div, holds all the other divs.
  116. oMenu.moveIt(sArrowwidth,null)
  117. oArrowRight.css.width = sArrowwidth;
  118. oArrowRight.moveIt(pageWidth-sArrowwidth,null)
  119. //Setting the width and the visible area of the links.
  120. if (!bw.ns4) oBg.css.overflow = "hidden";
  121. if (bw.ns6) oMenu.css.position = "relative";
  122. oBg.css.width = pageWidth+px;
  123. oBg.clipTo(0,pageWidth,sMenuheight,0)
  124. oBg.css.visibility = "visible";
  125. }
  126. //executing the init function on pageload if the browser is ok.
  127. if (bw.bw) onload = sideInit;
  128. </script>
  129. Entre <BODY> et </BODY>:
  130. <div id="divBg">
  131. <div id="divMenu">
  132.  <nobr>
  133.  [<a href="#">lien 1</a>]
  134.  [<a href="#">lien 2</a>]
  135.  [<a href="#">lien 3</a>]
  136.  [<a href="#">lien 4</a>]
  137.  [<a href="#">lien 5</a>] 
  138.  [<a href="#">lien 6</a>] 
  139.  [<a href="#">lien 7</a>] 
  140.  [<a href="#">lien 8</a>] 
  141.  [<a href="#">lien 9</a>] 
  142.  [<a href="#">lien 10</a>]
  143.  [<a href="#">lien 11</a>]
  144.  [<a href="#">lien 12</a>]
  145.  [<a href="#">lien 13</a>]
  146.  [<a href="#">lien 14</a>]
  147.  [<a href="#">lien 15</a>]
  148.  [<a href="#">lien 16</a>]
  149.  [<a href="#">lien 17</a>]
  150.  [<a href="#">lien 18</a>]
  151.  [<a href="#">lien 19</a>]
  152.  [<a href="#">lien 20</a>]
  153.  [<a href="#">lien 21</a>]
  154.  [<a href="#">lien 22</a>]
  155.  [<a href="#">lien 23</a>]
  156.  [<a href="#">lien 24</a>]
  157.  [<a href="#">lien 25</a>]
  158.  [<a href="#">lien 26</a>]
  159.  [<a href="#">lien 27</a>]
  160.  [<a href="#">lien 28</a>]
  161.  [<a href="#">lien 29</a>]
  162.  [<a href="#">lien 30</a>]
  163.  </nobr>
  164. </div>
  165. <div id="divArrowLeft"><a href="#" onmouseover="noScroll=false; mLeft()" onmouseout="noMove()" onclick="sScrollPx-=sScrollExtra; return false" onfocus="if(this.blur)this.blur()" onmousedown="sScrollPx+=sScrollExtra"><img src="arrowleft.gif" width="11" height="21" alt="" border="0"></a></div>
  166. <div id="divArrowRight"><a href="#" onmouseover="noScroll=false; mRight()" onmouseout="noMove()" onclick="sScrollPx-=sScrollExtra; return false" onfocus="if(this.blur)this.blur()" onmousedown="sScrollPx+=sScrollExtra"><img src="arrowright.gif" width="11" height="21" alt="" border="0"></a></div>
  167. </div>


 
le résultat affiche un menu qui défile horizontalement et qui affiche des liens. Je cherche comment remplacer chaque lien par un tableau qqn peut il m'aider?

Reply

Marsh Posté le 11-11-2004 à 23:22:14   

Reply

Sujets relatifs:

Leave a Replay

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