Foros del Web » Programando para Internet » Javascript »

Problema con menú desplegable

Estas en el tema de Problema con menú desplegable en el foro de Javascript en Foros del Web. Hola, He creado un menú desplegable. Hasta ahí todo bien. Pero mi duda viene cuando quiero que al hacer click sobre una de las opciones, ...
  #1 (permalink)  
Antiguo 02/01/2006, 13:16
Avatar de FleaBass  
Fecha de Ingreso: diciembre-2005
Ubicación: Bilbao
Mensajes: 3
Antigüedad: 18 años, 4 meses
Puntos: 0
Problema con menú desplegable

Hola,

He creado un menú desplegable. Hasta ahí todo bien. Pero mi duda viene cuando quiero que al hacer click sobre una de las opciones, el contenido se me abra por ejemplo en una ventana nueva.
Resumiendo: ¿Dónde tengo que colocar el target="_blank" en este código (para por ejemplo la url_1_1)?


Opción Noticias:

td_1 = "Noticias"
td_1_1 = "Home"
url_1_1 = "noticias/index.htm"
td_1_2 = "Archivo"
url_1_2 = "noticias/archivo.htm"

Gracias
  #2 (permalink)  
Antiguo 02/01/2006, 13:29
Avatar de JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 22 años, 2 meses
Puntos: 772
Hola FleaBass. Bienvenido al foro.

Así sin ver el código que usar va a ser difícil que alguien lo adivine Pon el código o si es muy largo un enlace a algún sitio donde se pueda ver.

Saludos,
  #3 (permalink)  
Antiguo 02/01/2006, 13:41
Avatar de FleaBass  
Fecha de Ingreso: diciembre-2005
Ubicación: Bilbao
Mensajes: 3
Antigüedad: 18 años, 4 meses
Puntos: 0
Gracias,

Este es el código "completo" con sus 2 opciones (Noticias y Biografías) y sus distintos sub-menús:
-----------------------------------------------------------
Cita:
<script language="javascript">
var tdColor="#000000"; // color del texto de los elementos del menu
var tdBgColor="#4A4135"; // color de fondo de los elementos del menu
var hlColor="#ffffff"; // color texto cuando puntero encima
var hlBgColor="#000000"; // color fondo cuando punetor encima
// Los mismos valores deben estar en menuNav.css

// Definicion del menu
td_1 = "Noticias"
url_1 = "noticias.htm"
td_1_1 = "Home"
url_1_1 = "noticias/home.htm"
td_1_2 = "Archivo"
url_1_2 = "noticias/archivo.htm"

td_2 = "Biografías"
url_2 = "bio.htm"
td_2_1 = "El grupo"
url_2_1 = "bio/elgrupo.htm"
td_2_2 = "Individuales"
url_2_2 = "bio/individuales.htm"
td_2_2_1 = "Chester Bennington"
url_2_2_1 = "bio/indi/chester.htm"
td_2_2_2 = "Mike Shinoda"
url_2_2_2 = "bio/indi/mike.htm"

///////NO SON NECESARIOS CAMBIOS A PARTIR DE AQUI/////////////////
var md=250;
var ti=-1;
var oTd=new Object;
oTd=null;

function doMenu(td){
clearTimeout(ti);
td.style.backgroundColor=hlBgColor;
td.style.color=hlColor;
var i;
var sT="";
var tda=new Array();
tda=td.id.split("_");
if(oTd!=null){
var tdo=new Array();
tdo=oTd.id.split("_");
for(i=1;i<tdo.length;i++){
sT+="_"+tdo[i];
if(tdo[i]!=tda[i]){
document.getElementById("td"+sT).style.backgroundC olor=tdBgColor;
document.getElementById("td"+sT).style.color=tdCol or;
if(document.getElementById("tbl"+sT)!=null)
document.getElementById("tbl"+sT).style.visibility ="hidden";
}
}
}
oTd=td;
sT="tbl";
for(i=1;i<tda.length;i++)
sT+="_"+tda[i];
if(document.getElementById(sT)!=null)
document.getElementById(sT).style.visibility="visi ble";

}

function clearMenu(){
if(oTd!=null){
var tdo=new Array();
tdo=oTd.id.split("_");
var sT="";
for(var i=1;i<tdo.length;i++){
sT+="_"+tdo[i];
document.getElementById("td"+sT).style.backgroundC olor=tdBgColor;
document.getElementById("td"+sT).style.color=tdCol or;
if(document.getElementById("tbl"+sT)!=null)
document.getElementById("tbl"+sT).style.visibility ="hidden";
}
oTd=null;
}
}

function runMenu(strURL){
location.href=strURL;
}

var tt="";
var sT="";
var pT=new Array();
var tA=new Array();

function getCoord(st){
tA=st.split("_");
if(tA.length>2){
tA=tA.slice(0,-1);
tt=tA.join("_");
return (document.getElementById("tbl"+tt).offsetTop+docum ent.getElementById("td"+st).offsetTop+4)+"px;left: "+
(document.getElementById("tbl"+tt).offsetLeft+docu ment.getElementById("td"+st).offsetWidth-2)+"px\">";
}
return (document.getElementById("mainmenu").offsetTop+doc ument.getElementById("td"+st).offsetHeight-1)+"px;left:"+
(document.getElementById("mainmenu").offsetLeft+do cument.getElementById("td"+st).offsetLeft+30)+"px\ ">";
}


</script>

Espero q eso te sirva.

Última edición por FleaBass; 03/01/2006 a las 06:58
  #4 (permalink)  
Antiguo 03/01/2006, 19:04
Avatar de FleaBass  
Fecha de Ingreso: diciembre-2005
Ubicación: Bilbao
Mensajes: 3
Antigüedad: 18 años, 4 meses
Puntos: 0
nadie me puede ayudar??
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:00.