Ver Mensaje Individual
  #3 (permalink)  
Antiguo 21/03/2003, 18:15
hchiesa
 
Fecha de Ingreso: enero-2002
Ubicación: Buenos Aires
Mensajes: 62
Antigüedad: 23 años, 1 mes
Puntos: 1
OK, ahi va.

function DetectorNavegador() {
this.NS4 = document.layers;
this.IE4 = document.all;
this.DHTML = this.NS4 || this.IE4;
}

var soporta = new DetectorNavegador();

var menu = new Array();
var menuActivo = null;

function activarMenu() {
if (soporta.DHTML && menuActivo != this) {
if (menuActivo) menuActivo.ocultar();
menuActivo = this;
this.mostrar();
}
}

function mostrarMenu() {
eval(this.capaRefStr + this.estiloRefStr + '.visibility = "visible"');
}

function ocultarMenu() {
eval(this.capaRefStr + this.estiloRefStr + '.visibility = "hidden"');
}

function cambiarPosicionMenu(top, left) {
if (soporta.DHTML) {
eval(this.capaRefStr + this.estiloRefStr + this.topRefStr + ' = top');
eval(this.capaRefStr + this.estiloRefStr + this.leftRefStr + ' = left');
}
}

function ocultarMenuActivo(e) {
if (menuActivo) {
menuActivo.ocultar();
menuActivo = null;
}
}

function Menu(capaID, top, left) {
this.activar = activarMenu;
this.mostrar = mostrarMenu;
this.ocultar = ocultarMenu;
this.cambiarPosicion = cambiarPosicionMenu;
this.capaRefStr = (soporta.NS4) ?
'document["'+capaID+'"]' :
'document.all["'+capaID+'"]';
this.estiloRefStr = (soporta.NS4) ? '' : '.style';
this.topRefStr = (soporta.NS4) ? '.top' : '.pixelTop';
this.leftRefStr = (soporta.NS4) ? '.left' : '.pixelLeft';
this.cambiarPosicion(top, left);
}

//menu[i] = new Menu(idMenu, posY, posX)

menu[0] = new Menu("menu0", 20, 5);
menu[1] = new Menu("menu1", 20, 93);
menu[2] = new Menu("menu2", 20, 250);
menu[3] = new Menu("menu3", 40, 350);