Mam taki skrypt:
  1. MenuWidth=130;
  2. MenuFont='Arial,Verdana';
  3. MenuFontSize=2;
  4. MenuFontColor='#000000';
  5. MenuBgColor='#eeeeee';
  6. HighLight='#b4c3d4';
  7. Separater=1;
  8. Centre=true;
  9.  
  10. n4=(document.layers);
  11. n6=(document.getElementById&&!document.all);
  12. ie=(document.all);
  13. h=(ie)?document.body.clientHeight:window.innerHeight;
  14. w=(ie)?document.body.clientWidth:window.innerWidth;
  15. Titles=new Array()
  16. Links=new Array()
  17.  
  18. algn1=(Centre)?'<center>':'';
  19. algn2=(Centre)?'</center>':'';
  20.  
  21. function colour2(c){(n4)?c.bgColor=HighLight:c.style.background=HighLight}//
  22. function colour1(c){(n4)?c.bgColor=MenuBgColor:c.style.background=MenuBgColor}//
  23.  
  24. var OpenLayer=(n4)?"<br><layer height=100% width=100% onMouseOver='colour1(this)'; onMouseOut='colour2(this)'>"+algn1:"<div style='height:auto;width:100%' onMouseOver='colour1(this)'; onMouseOut='colour2(this)'><font face="+MenuFont+" size="+MenuFontSize+" color="+MenuFontColor+">";
  25. var CloseLayer=(n4)?algn2+"</layer>":"</font></div>";
  26.  
  27. var vs=(n4)?"<font face='Wingdings' color="+MenuBgColor+">n</font>":OpenLayer+"&nbsp;"+CloseLayer+"";
  28.  
  29. Titles[0]="a";
  30. Titles[1]="b";
  31. Titles[2]="c";
  32. Titles[3]="d";
  33.  
  34. Links[0]=vs
  35. +OpenLayer+"1"+CloseLayer
  36. +OpenLayer+"2"+CloseLayer
  37. +OpenLayer+"3"+CloseLayer
  38.  
  39. Links[1]=vs
  40. +OpenLayer+"1"+CloseLayer
  41. +OpenLayer+"2"+CloseLayer
  42. +OpenLayer+"3"+CloseLayer
  43. +OpenLayer+"4"+CloseLayer
  44. +OpenLayer+"5"+CloseLayer
  45. +OpenLayer+"6"+CloseLayer
  46.  
  47. Links[2]=vs
  48. +OpenLayer+"1"+CloseLayer
  49. +OpenLayer+"2"+CloseLayer
  50. +OpenLayer+"3"+CloseLayer
  51. +OpenLayer+"4"+CloseLayer
  52.  
  53. Links[3]=vs
  54. +OpenLayer+"1"+CloseLayer
  55. +OpenLayer+"2"+CloseLayer
  56.  
  57. w1=(MenuWidth+Separater)*Titles.length;
  58. w2=w/2;
  59. i1=w2-MenuWidth-Separater-w1/2;
  60. i2=w2-MenuWidth-Separater-w1/2;
  61. s1=MenuWidth+Separater;
  62. s2=MenuWidth+Separater;
  63. if (w1 > w2*2){i1=-MenuWidth;i2=-MenuWidth}
  64. vy=(n4)?'show':'visible';
  65. vn=(n4)?'hide':'hidden';
  66.  
  67. if (n4){
  68. for (i=0; i < Titles.length; i++){
  69. document.write("<layer name='lnks"+i+"' top=0 left="+(i2+=s2)+" "
  70. +" width="+MenuWidth+" bgcolor="+HighLight+" visibility=hide"
  71. +" onMouseOver='this.visibility=vy; var cd=this.id.length-1; var ab=this.id.charAt(cd); H(ab)' "
  72. +" onMouseOut='this.visibility=vn; var ef=this.id.length-1; var gh=this.id.charAt(ef); B(gh)'>"
  73. +algn1+"<font face="+MenuFont+" size="+MenuFontSize+">"
  74. +"&nbsp;<br>"+Links[i]+"</font>"+algn2+"</layer>");
  75. document.write("<layer name='ttls"+i+"' top=0 left="+(i1+=s1)+" height=0 "
  76. +"width="+MenuWidth+" bgcolor="+MenuBgColor+" "
  77. +"onMouseOver=\"this.bgColor=HighLight; var e=this.id.length-1; var d=this.id.charAt(e); On(d)\" "
  78. +"onMouseOut=\"this.bgColor=MenuBgColor; var e=this.id.length-1; var d=this.id.charAt(e); Off(d)\">"
  79. +algn1+"<font face="+MenuFont+" size="+MenuFontSize+" color="+MenuFontColor+">"
  80. +Titles[i]+"</font>"+algn2+"</layer>");
  81. }
  82. function On(x){for (i=0; i < Titles.length; i++)document.layers['lnks'+x].visibility=vy}
  83. function Off(x){for (i=0; i < Titles.length; i++)document.layers['lnks'+x].visibility=vn}
  84. function B(y){for (i=0; i < Titles.length; i++)document.layers['ttls'+y].bgColor=MenuBgColor}
  85. function H(y){for (i=0; i < Titles.length; i++)document.layers['ttls'+y].bgColor=HighLight}
  86. }
  87. if (!n4){
  88. for (i=0; i < Titles.length; i++){
  89. document.write("<div id='lnks"+i+"' style='position:absolute;"
  90. +"top:0px;left:"+(i2+=s2)+"px;width:"+MenuWidth+"px;"
  91. +"background:"+HighLight+";visibility:hidden'"
  92. +" onMouseOver='this.style.visibility=vy; document.getElementById(\"ttls"+i+"\").style.background=HighLight';"
  93. +" onMouseOut='this.style.visibility=vn; document.getElementById(\"ttls"+i+"\").style.background=MenuBgColor'>"
  94. +algn1+Links[i]+algn2+"</div>");
  95. document.write("<div id='ttls"+i+"' style='position:absolute;top:0px;left:"+(i1+=s1)+"px;height:auto;width:"+MenuWidth+"px;"
  96. +"background:"+MenuBgColor+";cursor:default'"
  97. +" onMouseOver='document.getElementById(\"lnks"+i+"\").style.visibility=vy;this.style.background=HighLight'"
  98. +" onMouseOut='document.getElementById(\"lnks"+i+"\").style.visibility=vn;this.style.background=MenuBgColor'>"
  99. +algn1+"<font face="+MenuFont+" size="+MenuFontSize+" color="+MenuFontColor+">"+Titles[i]+"</font>"+algn2+"</div>");
  100. }
  101. }
  102. function Scroll(){
  103. sy=(ie)?document.body.scrollTop:window.pageYOffset;
  104. for (i=0; i < Titles.length; i++){
  105. if (n4){
  106. document.layers['ttls'+i].top=Separater+sy;
  107. document.layers['lnks'+i].top=Separater+sy;
  108. }
  109. else{
  110. document.getElementById("ttls"+i).style.top=Separater+sy;
  111. document.getElementById("lnks"+i).style.top=Separater+sy;
  112. }
  113. }
  114. setTimeout('Scroll()',150)
  115. }
  116. Scroll();
  117. window.onresize=new Function("window.location.reload()");
  118.  
  119.  
  120. if (!n4){
  121. for (i=0; i < document.links.length; i++){
  122. if (document.links[i].href == this.window.location.href)
  123. {
  124. document.links[i].style.color=MenuBgColor;
  125. document.links[i].style.cursor='crosshair';
  126. //document.links[i].innerHTML+=' -';
  127. //alert(i+' '+document.links[i].href);
  128. break;
  129. }
  130. }
  131. }

Wie ktoś jak to przerobić żeby działało pod IE? FF nie ma problemu. :/ Chyba coś z
Kod
ie=(document.all);
, nie?