Ir para conteúdo
Fórum Script Brasil
  • 0

Js + Asp


gu_lt

Pergunta

2 respostass a esta questão

Posts Recomendados

  • 0

Este é menu que deve ficar "flutuando":

<script>

var LFMenuRubric = new LFMenu(false,true,"LFMenuRubric",5,265);

 

  var LFMenuRubric_0 = new LFMenuItem("LFMenuRubric_0",true,false,"<a id='ssrub'><table width=210 border=0 bgcolor=#FFFFFF height='19' width='210'><td align='center' valign='middle' width=10><img height='11' hspace='3' src='../images/bullet-titulo.gif' width='11'></td><td><span class='titulomenu'>CAMPANHAS ON-LINE</span></td></table></a>","groupehaut2",19,210);

  LFMenuRubric.addMenuItem(LFMenuRubric_0); 

 

  var LFMenuRubric_1 = new LFMenuItem("LFMenuRubric_1",true,false,"<a id='ssrub'><table width=210 border=0 bgcolor=#FFFFFF height='19' width='210'><td align='center' valign='middle' width=10><img height='7' hspace='3' src='../images/bullet.gif' width='7'></td><td><A href='eficiencia.asp?menu=5' class='menu'>EFICI&Ecirc;NCIA DA WEB</a></td></table></a>","actualiteshaut2",19,210);

  LFMenuRubric.addMenuItem(LFMenuRubric_1);   

 

  var LFMenuRubric_2 = new LFMenuItem("LFMenuRubric_2",true,false,"<a id='ssrub'><table width=210 border=0 bgcolor=#FFFFFF height='19' width='210'><td align='center' valign='middle' width=10><img height='7' hspace='3' src='../images/bullet.gif' width='7'></td><td><a href='formatos.asp?menu=5' class='menu'>FORMATOS</a></td></table></a>","recrutementhaut2",19,210);

  LFMenuRubric.addMenuItem(LFMenuRubric_2);

 

  var LFMenuRubric_3 = new LFMenuItem("LFMenuRubric_3",true,false,"<a id='ssrub'><table width=210 border=0 bgcolor=#FFFFFF height='19' width='210'><td align='center' valign='middle' width=10><img height='7' hspace='3' src='../images/bullet.gif' width='7'></td><td><a href='retorno.asp?menu=5' class='menu'>RETORNO DE UMA CAMPANHA</a></td></table></a>","pressroomhaut2",19,210);

  LFMenuRubric.addMenuItem(LFMenuRubric_3);

  var LFMenuRubric_4 = new LFMenuItem("LFMenuRubric_4",true,false,"<a id='ssrub'><table width=210 border=0 bgcolor=#FFFFFF height='19' width='210'><td align='center' valign='middle' width=10><img height='7' hspace='3' src='../images/bullet.gif' width='7'></td><td><a href='roi.asp?menu=5' class='menu'>R.O.I.</a></td></table></a>","pressroomhaut2",19,170);

  LFMenuRubric.addMenuItem(LFMenuRubric_4);

  var LFMenuRubric_5 = new LFMenuItem("LFMenuRubric_5",true,false,"<a id='ssrub'><table width=210 border=0 bgcolor=#FFFFFF height='19' width='210'><td align='center' valign='middle' width=10><img height='7' hspace='3' src='../images/bullet.gif' width='7'></td><td><a href='numeros.asp?menu=5' class='menu'>N&Uacute;MEROS</a></td></table></a>","pressroomhaut2",19,170);

  LFMenuRubric.addMenuItem(LFMenuRubric_5);

 

  LFMenuRubric.writeMenu();

LFMenuRubric.openMenu([-1]);

</SCRIPT>

Este é o JS:

function LFUtils() {}

LFUtils.ns4=(document.layers);

LFUtils.ie4=(document.all&&!document.getElementById);

LFUtils.ie5=(document.all&&document.getElementById);

LFUtils.ns6=(!document.all&&document.getElementById);

LFUtils.getElement = function (DivId){

if(LFUtils.ie5||LFUtils.ns6) return(document.getElementById(DivId));

if(LFUtils.ie4) return(document.all[DivId]);

if(LFUtils.ns4) return(document.layers[DivId]);

}

LFUtils.getHeight = function (DivId){

var theid = LFUtils.getElement(DivId)

return (theid.innerHeight)?theid.innerHeight:theid.clientHeight;

}

LFUtils.getWidth = function(DivId){

var theid = LFUtils.getElement(DivId)

return (theid.innerWidth)?theid.innerWidth:theid.clientWidth;

}

LFUtils.getStyle = function (id){

if (LFUtils.ie5||LFUtils.ns6) return document.getElementById(id).style;

if(LFUtils.ns4) return document.layers[id];

if(LFUtils.ie4) return document.all[id].style;

}

LFUtils.getVScroll = function (){

if(window.pageYOffset)

  return window.pageYOffset;

else

  return document.body.scrollTop;

}

function LFMenu(_open,_slide,_id,_X,_Y) {

this.open = _open; this.slide = _slide; this.id = _id;

this.posX = _X;this.posY = _Y;

this.initX = _X;this.initY = _Y;

this.baseX = _X;this.baseY = _Y;

this.subDeltaX = 0;this.subDeltaY = 0;

this.children = [];

}

LFMenu.prototype.addMenuItem = function(menuItem){

menuItem.setDeep(0,this.children.length,this);

this.children[this.children.length] = menuItem;

}

LFMenu.prototype.initXY = function(tab){

this.posY= this.initY;

if (this.slide && !this.open) this.slideSubMenu(tab)

}

LFMenu.prototype.setShowing = function(_showing){}

LFMenu.prototype.openMenu = function(tab){

this.isOpen = true;

this.initXY(tab);

for (var i=0;i<this.children.length;i++){

  this.children.setLocation (this.posX,this.posY);

  this.children.setVisible(true);

  this.posY = this.posY+this.children.getYMove(tab);

 

  if (this.open || (tab.length > 0 && i == tab[0] ) ) {

  this.posX = this.posX+this.children.getXMove(tab);

  this.posY = this.children.open(this.posX,this.posY,tab,this.open);

  this.posX = this.posX-this.children.getXMove(tab);

  } else {

  this.children.close();

  }

}

}

LFMenu.prototype.slideMenu = function(){

var X = this.baseX;

var Y = this.baseY-this.subDeltaY;

if (LFUtils.getVScroll() > Y) Y = LFUtils.getVScroll();

if (this.posX != X || this.posY != Y)

  this.setLocation (X,Y);

}

LFMenu.prototype.slideSubMenu = function(tab){

this.subDeltaX = 0;

this.subDeltaY = 0;

for (var i=0;i<tab[0];i++)

  this.subDeltaY += this.children.getYMove(tab,this.open);

}

LFMenu.prototype.slideLocation = function(dX,dY){

this.initX = this.initX+dX;

this.initY = this.initY+dY;

this.posX= this.initX;

this.posY= this.initY;

for (var i=0;i<this.children.length;i++)

  this.children.slideLocation(dX,dY);

}

LFMenu.prototype.setLocation = function(_X,_Y){

var dX = _X - this.initX;

var dY = _Y - this.initY;

var vitesse = 3;

dX = _X<this.initX?Math.floor(dX/vitesse):Math.ceil(dX/vitesse);

dY = _Y<this.initY?Math.floor(dY/vitesse):Math.ceil(dY/vitesse);

if (dX != 0 || dY !=0)

  this.slideLocation(dX,dY);

}

LFMenu.prototype.writeMenu = function(){

for (var i=0;i<this.children.length;i++)

  this.children.writeMenu();

if (this.slide)

  window.setInterval(this.id+".slideMenu()",100);

this.slideLocation(0,0);

this.openMenu([]);

}

function LFMenuItem(_id,_onMouseOver,_openOnClic,_label,_classe,_height,_width) {

this.id = _id; this.onMouseOver = _onMouseOver; this.openOnClic= _openOnClic;

this.label = _label; this.classe = _classe;

this.children = []; this.posX = 0; this.posY = 0;

this.height = _height; this.width = _width; this.isOpen = false;

}

LFMenuItem.prototype.getHeight = function (){

return LFUtils.getHeight(this.id);

}

LFMenuItem.prototype.getWidth = function(){

return LFUtils.getWidth(this.id);

}

LFMenuItem.prototype.addMenuItem = function ( menuItem ) {

menuItem.setDeep(this.level+1,this.children.length,this);

this.children[this.children.length] = menuItem;

}

LFMenuItem.prototype.setDeep = function (_level,_index,_owner){

this.level = _level; this.index = _index; this.owner = _owner;

}

LFMenuItem.prototype.slideLocation = function(dX,dY){

this.setLocation(this.posX+dX,this.posY+dY);

for (var i=0;i<this.children.length;i++)

  this.children.slideLocation(dX,dY);

}

LFMenuItem.prototype.setLocation = function(X,Y){

this.posX = X; this.posY = Y;

LFUtils.getStyle(this.id).left = this.posX +"px";

LFUtils.getStyle(this.id).top = this.posY +"px";

}

LFMenuItem.prototype.setVisible = function(visible){

if (visible) {

  LFUtils.getStyle(this.id).zIndex = this.level;

  LFUtils.getStyle(this.id).visibility = "visible";

} else

  LFUtils.getStyle(this.id).visibility = "hidden";

}

LFMenuItem.prototype.getYMove = function(tab,open){

var res=this.getHeight();

if (open)

  for (var i=0;i<this.children.length;i++)

  res+= this.children.getYMove(tab,open);

return res;

}

LFMenuItem.prototype.getXMove = function(tab,open){

return 10;

}

LFMenuItem.prototype.close = function(){

for (var i=0;i<this.children.length;i++){

  this.children.close();

  this.children.setVisible(false);

}

this.isOpen = false;

}

LFMenuItem.prototype.open = function(X,Y,tab,open){

var posx = X; var posy = Y;

for (var i=0;i<this.children.length;i++){

  this.children.setLocation (posx,posy);

  this.children.setVisible(true);

  posy = posy+this.children.getYMove(tab);

  if (open || (tab.length > this.children.level && i == tab[this.children.level] ) ) {

  posx = posx+this.children.getXMove(tab);

  posy = this.children.open(posx,posy,tab,open);

  posx = posx-this.children.getXMove(tab);

  } else

  this.children.close();

}

this.isOpen = true;

return posy;

}

LFMenuItem.prototype.show = function(){

if (!this.isOpen ) {

  var posx = this.posX;

  var posy = this.posY+this.getYMove();

  this.setShowing(true);

  for (var i=0;i<this.owner.children.length;i++)

  if (i != this.index) this.owner.children.hide();

  for (var i=0;i<this.children.length;i++){

  posx = posx+this.children.getXMove();

  this.children.setLocation (posx,posy); 

  this.children.setVisible(true);

  LFUtils.getStyle(this.children.id).zIndex = this.level+3;

  posy = posy+this.children.getYMove();

  posx = posx-this.children.getXMove();

  }

}

}

LFMenuItem.prototype.hide = function(){

//TODO : la gestion des menu dep > 3 est incorrecte

if (!this.isOpen && !this.showing) {

  for (var i=0;i<this.children.length;i++){

  this.children.setVisible(false);

  this.children.hide();

  }

  this.hideMe();

}

}

LFMenuItem.prototype.hideMe = function(){

if (!this.isOpen && !this.showing)

  for (var i=0;i<this.owner.children.length;i++)

  if (!this.owner.isOpen && !this.owner.showing) this.owner.children.setVisible(false);

}

LFMenuItem.prototype.writeMenu = function(){

document.write("<div id='"+this.id+"' style='visibility:hidden;position:absolute;width:"+this.width+"px;' class='"+this.classe+"'");

if (this.onMouseOver)

  document.write(" onmouseover='javascript:"+this.id+".showMenu()' onmouseout='javascript:"+this.id+".hideMenu()'");

if (this.openOnClic)

  document.write(" onclick='javascript:"+this.id+".openMenu([])'");

document.write(">");

document.write(this.label);

document.write("</div>");

for (var i=0;i<this.children.length;i++)

  this.children.writeMenu();

}

LFMenuItem.prototype.openMenu = function(tab){

tab[this.level]=this.index;

this.owner.openMenu(tab);

}

LFMenuItem.prototype.showMenu = function(){

this.show();

}

LFMenuItem.prototype.hideMenu = function(){

this.setShowing(false);

setTimeout(this.id+".hide()",150);

}

LFMenuItem.prototype.setShowing = function(_showing){

this.showing = _showing;

this.owner.setShowing(_showing);

}

Desde já valews

Gustavo Lemes

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,3k
×
×
  • Criar Novo...