Jump to content
Fórum Script Brasil
  • 0

Menu Rolante


Heitor Prado

Question

Bom estou tentando fazer um menu rolante para quando eu descer a barra o menu tb descer... e eu estou usando este codigo que peguei aki mesmo no SB:

<script LANGUAGE="JavaScript">

<!--

function setVariables() {

if (navigator.appName == "Netscape") {

v=".top=";

dS="document.";

sD="";

y="window.pageYOffset";

}

else {

v=".pixelTop=";

dS="";

sD=".style";

y="document.body.scrollTop";

}

}

function checkLocation() {

object="object1";

yy=eval(y);

eval(dS+object+sD+v+yy);

setTimeout("checkLocation()",10);

}

// -->

</script>

só q o meu TOP é 305px e o meu LEFT é 552px....

e eu não sei como mudar isso...

o q esta acontecendo é q meu menu vai lá plo TOPO sendo q não é lá q ele começa.....

desde já agradeço... e qualquer coisa estou no icq....

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Tente este daqui:

<html>

<head>
<STYLE TYPE="text/css">
<!--

.menuh	{
  BORDER-COLOR : #FFFF99;
  cursor : hand;
  Border-Left : #FFFF99;
  Border-Top : #FFFF99;
  Padding-Left : 1px;
  Padding-Top : 1px;
  Background-Color : #FFFF99;
	}
.menu	{
  Background-Color : white;
	}
.home	{
  cursor : hand;
	}

.menulinks{
text-decoration:none;
}
//-->
</STYLE>
<head>

<body>
<script Language="Javascript1.2">
<!--

var menuwidth=110
var offsetleft=10
var offsettop=90

var ns4=document.layers?1:0
var ie4=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0

function makeStatic() {
if (ie4) {object1.style.pixelTop=document.body.scrollTop+offsettop}
else if (ns6) {document.getElementById("object1").style.top=window.pageYOffset+offsettop}
else if (ns4) {eval(document.object1.top=eval(window.pageYOffset+offsettop));}
setTimeout("makeStatic()",0);
}

if (ie4||ns6) {document.write('<span ALIGN="CENTER" ID="object1" STYLE="Position:absolute; Top:20; Left:'+offsetleft+'; Z-Index:5;cursor:hand;background-color:black;"><TABLE BORDER="1" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" BORDERCOLOR="black" bgcolor="white">')}
else if (ns4){ document.write('<LAYER top="20" name="object1" left="'+offsetleft+'" BGCOLOR=black><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="1"><TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width="'+menuwidth+'">')}

if (ie4||ns6||ns4)
document.write('<TR><TD BGCOLOR="#3399FF" BORDERCOLORDARK="#99CCFF" BORDERCOLORLIGHT="#003399"><P ALIGN=CENTER><FONT SIZE="2" FACE=Verdana>Menu</FONT></TD></TR>')

var menui = new Array();
var menul = new Array();



menui[0]="link 1";
menui[1]="link 2";
menui[2]="link 3";
menui[3]="link 4";
menui[4]="link 5";

menul[0]="pagina.html";
menul[1]="pagina.html";
menul[2]="pagina.html";
menul[3]="pagina.html";
menul[4]="pagina.html";


for (i=0;i<=menui.length-1;i++)
if (ie4||ns6) {document.write('<TR><TD BORDERCOLOR="white" ONCLICK="location=\''+menul[i]+'\'" onmouseover="className=\'menuh\'" onMouseout="className=\'menu\'"><CENTER><FONT>'+menui[i]+'</FONT></TD></TR>')}
else if (ns4){document.write('<TR><TD BGCOLOR="white"><ILAYER><LAYER width="'+menuwidth+'" onmouseover="bgColor=\'yellow\'" onmouseout="bgColor=\'white\'"><CENTER><A HREF="'+menul[i]+'" class=menulinks>'+menui[i]+'</A></CENTER></LAYER></ILAYER></TD></TR>')}

if (ie4||ns6) {document.write('</TABLE></span>')}
else if (ns4){document.write('</TABLE></TD></TR></TABLE></LAYER>')}

function menu3(){
if (ns6||ie4||ns4)
makeStatic()
}

window.onload=menu3

//-->
</SCRIPT>
</body>

<p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p><p><br></p>

</html>

Para mudar os tamnahos é só alterar estes dados:

var menuwidth=110

var offsetleft=10

var offsettop=90

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      651.8k
×
×
  • Create New...