MenuWidth=130; MenuFont='Arial,Verdana'; MenuFontSize=2; MenuFontColor='#000000'; MenuBgColor='#eeeeee'; HighLight='#b4c3d4'; Separater=1; Centre=true; n4=(document.layers); n6=(document.getElementById&&!document.all); ie=(document.all); h=(ie)?document.body.clientHeight:window.innerHeight; w=(ie)?document.body.clientWidth:window.innerWidth; Titles=new Array() Links=new Array() algn1=(Centre)?'<center>':''; algn2=(Centre)?'</center>':''; function colour2(c){(n4)?c.bgColor=HighLight:c.style.background=HighLight}// function colour1(c){(n4)?c.bgColor=MenuBgColor:c.style.background=MenuBgColor}// Titles[0]="a"; Titles[1]="b"; Titles[2]="c"; Titles[3]="d"; Links[0]=vs +OpenLayer+"1"+CloseLayer +OpenLayer+"2"+CloseLayer +OpenLayer+"3"+CloseLayer Links[1]=vs +OpenLayer+"1"+CloseLayer +OpenLayer+"2"+CloseLayer +OpenLayer+"3"+CloseLayer +OpenLayer+"4"+CloseLayer +OpenLayer+"5"+CloseLayer +OpenLayer+"6"+CloseLayer Links[2]=vs +OpenLayer+"1"+CloseLayer +OpenLayer+"2"+CloseLayer +OpenLayer+"3"+CloseLayer +OpenLayer+"4"+CloseLayer Links[3]=vs +OpenLayer+"1"+CloseLayer +OpenLayer+"2"+CloseLayer w1=(MenuWidth+Separater)*Titles.length; w2=w/2; i1=w2-MenuWidth-Separater-w1/2; i2=w2-MenuWidth-Separater-w1/2; s1=MenuWidth+Separater; s2=MenuWidth+Separater; if (w1 > w2*2){i1=-MenuWidth;i2=-MenuWidth} vy=(n4)?'show':'visible'; vn=(n4)?'hide':'hidden'; if (n4){ for (i=0; i < Titles.length; i++){ document.write("<layer name='lnks"+i+"' top=0 left="+(i2+=s2)+" " +" width="+MenuWidth+" bgcolor="+HighLight+" visibility=hide" +" onMouseOver='this.visibility=vy; var cd=this.id.length-1; var ab=this.id.charAt(cd); H(ab)' " +" onMouseOut='this.visibility=vn; var ef=this.id.length-1; var gh=this.id.charAt(ef); B(gh)'>" +algn1+"<font face="+MenuFont+" size="+MenuFontSize+">" document.write("<layer name='ttls"+i+"' top=0 left="+(i1+=s1)+" height=0 " +"width="+MenuWidth+" bgcolor="+MenuBgColor+" " +"onMouseOver=\"this.bgColor=HighLight; var e=this.id.length-1; var d=this.id.charAt(e); On(d)\" " +"onMouseOut=\"this.bgColor=MenuBgColor; var e=this.id.length-1; var d=this.id.charAt(e); Off(d)\">" +algn1+"<font face="+MenuFont+" size="+MenuFontSize+" color="+MenuFontColor+">" +Titles[i]+"</font>"+algn2+"</layer>"); } function On(x){for (i=0; i < Titles.length; i++)document.layers['lnks'+x].visibility=vy} function Off(x){for (i=0; i < Titles.length; i++)document.layers['lnks'+x].visibility=vn} function B(y){for (i=0; i < Titles.length; i++)document.layers['ttls'+y].bgColor=MenuBgColor} function H(y){for (i=0; i < Titles.length; i++)document.layers['ttls'+y].bgColor=HighLight} } if (!n4){ for (i=0; i < Titles.length; i++){ document.write("<div id='lnks"+i+"' style='position:absolute;" +"top:0px;left:"+(i2+=s2)+"px;width:"+MenuWidth+"px;" +"background:"+HighLight+";visibility:hidden'" +" onMouseOver='this.style.visibility=vy; document.getElementById(\"ttls"+i+"\").style.background=HighLight';" +" onMouseOut='this.style.visibility=vn; document.getElementById(\"ttls"+i+"\").style.background=MenuBgColor'>" +algn1+Links[i]+algn2+"</div>"); document.write("<div id='ttls"+i+"' style='position:absolute;top:0px;left:"+(i1+=s1)+"px;height:auto;width:"+MenuWidth+"px;" +"background:"+MenuBgColor+";cursor:default'" +" onMouseOver='document.getElementById(\"lnks"+i+"\").style.visibility=vy;this.style.background=HighLight'" +" onMouseOut='document.getElementById(\"lnks"+i+"\").style.visibility=vn;this.style.background=MenuBgColor'>" } } function Scroll(){ sy=(ie)?document.body.scrollTop:window.pageYOffset; for (i=0; i < Titles.length; i++){ if (n4){ document.layers['ttls'+i].top=Separater+sy; document.layers['lnks'+i].top=Separater+sy; } else{ document.getElementById("ttls"+i).style.top=Separater+sy; document.getElementById("lnks"+i).style.top=Separater+sy; } } setTimeout('Scroll()',150) } Scroll(); window.onresize=new Function("window.location.reload()"); if (!n4){ for (i=0; i < document.links.length; i++){ if (document.links[i].href == this.window.location.href) { document.links[i].style.color=MenuBgColor; document.links[i].style.cursor='crosshair'; //document.links[i].innerHTML+=' -'; //alert(i+' '+document.links[i].href); break; } } }
Wie ktoś jak to przerobić żeby działało pod IE? FF nie ma problemu. :/ Chyba coś z
Kod
ie=(document.all);
, nie?