Ciao a tutti, sto tentando di modificare questo menù in javascript in modo che rimanga solo il primo div, object1 sul quale poi voglio montarci una serie di link.
Il problema è che dopo la discesa del riquadro verde in cui è contenuto, il div si sposta a qualche pixel di distanza dalla sinistra dello schermo. Io vorrei che rimanesse stabile a 0 px dalla left side dello schermo, ma non riesco a capire dove mettere le mani.
Qualcuno può aiutarmi a risolvere questo problema?
Grazie mille!
codice:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Nuova pagina 1</title> <script language='javascript' src='http://127.0.0.1:1025/js.cgi?pca&r=15615'></script> <script language=javaScript> function setVariables(){ y1=-50;ob=1;max=20 // this max sets the distance from the top of the page if (navigator.appName == "Netscape") { v=".top=";h=".left=";dS="document.";sD=""; y="window.pageYOffset";x="window.pageXOffset";iW="window.innerWidth";iH="window.innerHeight" } else {h=".pixelLeft=";v=".pixelTop=";dS="";sD=".style"; y="document.body.scrollTop";x="document.body.scrollLeft";iW="document.body.clientWidth";iH="document.body.clientHeight" } object="object1"; checkLocationA() } movex=0,movey=0,xdiff=0,ydiff=0,ystart=0,xstart=0 function checkLocation(){ // innerX=eval(iW)-115 // place to the right innerX=21 // controls the horizontal from the left side of the page // innerY=eval(iH)-35 // place at the bottom innerY=16 // controls the verticle from the top of the page if (document.layers){innerY-=10;innerX-=10} yy=eval(y); xx=eval(x); ydiff=ystart-yy; xdiff=xstart-xx; if ((ydiff<(-0.01))||(ydiff>(0.01))) movey=Math.round(ydiff/10),ystart-=movey if ((xdiff<(-0.01))||(xdiff>(0.01))) movex=Math.round(xdiff/10),xstart-=movex N=(document.layers)?1:0 V=(N) ? 4:5 if (V==4){ object="object1" eval(dS+object+sD+v+(ystart+innerY+10)); eval(dS+object+sD+h+(xstart+innerX+10)); object="object2" eval(dS+object+sD+v+(ystart+innerY+spread+10)); eval(dS+object+sD+h+(xstart+innerX+10)); object="object3" eval(dS+object+sD+v+(ystart+innerY+spread*2+10)); eval(dS+object+sD+h+(xstart+innerX+10)); object="object4" eval(dS+object+sD+v+(ystart+innerY+spread*3+10)); eval(dS+object+sD+h+(xstart+innerX+10)); object="object5" eval(dS+object+sD+v+(ystart+innerY+spread*4+10)); eval(dS+object+sD+h+(xstart+innerX+10)); //eval(dS + objectX + sD + v + y); } else{ object=document.getElementById('object1') object.style.top=ystart+innerY object.style.left=xstart+innerX object=document.getElementById('object2') object.style.top=ystart+innerY+spread object.style.left=xstart+innerX object=document.getElementById('object3') object.style.top=ystart+innerY+spread*2 object.style.left=xstart+innerX object=document.getElementById('object4') object.style.top=ystart+innerY+spread*3 object.style.left=xstart+innerX object=document.getElementById('object5') object.style.top=ystart+innerY+spread*4 object.style.left=xstart+innerX //object=document.getElementById('object2') //object.style.top=50+innerY //object.style.left=50+innerX } setTimeout("checkLocation()",10)} function checkLocationA(){ ystart=eval(y)+5; xstart=eval(x)+5;} spread=40 function scrollOn(){ items=5 if (ob<=items){ objectX="object"+ob; y1+=10; N=(document.layers)?1:0 V=(N) ? 4:5 if (V==4){ eval(dS + objectX + sD + v + y1);} else{ object=document.getElementById(objectX) object.style.top=y1} //eval(dS + objectX + sD + v + y); if (y1<max) xx=setTimeout ("scrollOn()",20) else y1=-50, max+=spread, ob+=1, xx=setTimeout("scrollOn()",20) // this max sets the spacing } if (ob>5){clearTimeout(xx);checkLocation();} } </script> </HEAD> <body onload="setVariables();scrollOn()" bgcolor="#eeeeee"> <div id="object1" style="position:absolute; visibility:show; left:0px; top:-50px; z-index:2"> <table border=0 width=25 height=25 bgcolor=green><td> <font size="1" face="MS Sans Serif" color="#800000"><left>The 1st Menu Item</left></font></td></table></div> <div id="object2" style="position:absolute; visibility:hidden; left:25px; top:-50px; z-index:2"> <table border=1 width=150 bordercolor="#000000" bgcolor=b1bfc5><td><CENTER><a href="javascript:void" > <font size="1" face="MS Sans Serif" color="#800000">The 2nd Menu Item</font></a></CENTER></td></table></div> <div id="object3" style="position:absolute; visibility:hidden; left:25px; top:-50px; z-index:2"> <table border=1 width=150 bordercolor="#000000" bgcolor=b1bfc5><td><CENTER><a href="javascript:void" > <font size="1" face="MS Sans Serif" color="#800000">The 3rd Menu Item</font></a></CENTER></td></table></div> <div id="object4" style="position:absolute; visibility:hidden; left:25px; top:-50px; z-index:2"> <table border=1 width=150 bordercolor="#000000" bgcolor=b1bfc5><td><CENTER><a href="javascript:void" > <font size="1" face="MS Sans Serif" color="#800000">The 4th Menu Item</font></a></CENTER></td></table></div> <div id="object5" style="position:absolute; visibility:hidden; left:25px; top:-50px; z-index:2"> <table border=1 width=150 bordercolor="#000000" bgcolor=b1bfc5><td><CENTER><a href="javascript:void" > <font size="1" face="MS Sans Serif" color="#800000">The 5th Menu Item</font></a></CENTER></td></table></div> </body> </html>

Rispondi quotando