Evertjan. escribió:
Winston wrote on 08 dec 2006 in comp.lang.javascript:
>Evertjan. escribió:
>>Winston wrote on 08 dec 2006 in comp.lang.javascript:
<li><a href="preguntas.shtml" onclick="ShowMenu('menu_p')"
title="P">Preguntas</a></li>
the href is executed leaving the page for another or the same one,
and the script result cannot be seen anymore.
try:
<a href="preguntas.shtml" onclick="ShowMenu('menu_p');return false;"
title="P">Preguntas</a>
href="preguntas.shtml" is here only executed if js is off or not
available.
When I click on [preguntas.shtml] the page load normally in other DIV.
That is OK, but my problem is that when I click on it I have, just for
ONE second the submenu.
<li><a href="preg_html.shtml">HTML</a></li>
<li><a href="preg_css.shtml">CSS</a></li>
That is as it should be, given your code.
[fun_menu.js]
function Cambiar() {
var posibles = document.cambiando_estilos.Seleccionar;
document.getElementById("estilos").href=posibles.o ptions[posibles.selectedIndex].value;
}
function Reloj_Activo(){
Hora_Actual = new Date();
hora = Hora_Actual.getHours();
minuto = Hora_Actual.getMinutes();
segundo = Hora_Actual.getSeconds();
salida = hora + " : " + minuto + " : " + segundo;
document.Reloj.aqui_hora.value = salida;
setTimeout("Reloj_Activo()",1000);
}
function MostrarMenu(objeto) {
esta_abierto = document.getElementById(objeto).style.display;
//document.getElementById("menu_preguntas").style.di splay='none';
// Si no estaba expandido, que lo expanda.
if (esta_abierto == 'none') {
document.getElementById(objeto).style.display='blo ck';
alert("Estaba cerrado");
}
else {
document.getElementById(objeto).style.display='non e' ;
alert("Estaba abierto");
}
}
[menu.html]
<script src="fun_menu.js"></script>
<form name="Reloj"><input class="relojes" type="text" name="aqui_hora"
size="12" onfocus="window.document.Reloj.aqui_hora.blur()"></form>
<hr/>
<ul>
<li><a href="index.shtml" title="Objetivo">Introduccion</a></li>
<li><a href="cv.shtml" title="Texto + Listas -
(C.V.)">C.V</a></li>
<li><a href="multimedia.shtml" title="Multimedia">Multimedia</a></li>
<li><a href="dondeestuve.shtml" title="Enlaces">Enlaces</a>
<li><a href="preguntas.shtml"
onclick="MostrarMenu('menu_preguntas')" title="Preguntas">Preguntas</a></li>
<div id="menu_preguntas" style="display='block'">
<ul>
<li><a href="preg_html.shtml" title="Preguntas sobre
HTML">HTML</a></li>
<li><a href="preg_css.shtml" title="Preguntas sobre
CSS">CSS</a></li>
<li><a href="preg_javascript.shtml" title="Preguntas sobre
JavaScript">JavaScript</a></li>
<li><a href="preg_php.shtml" title="Preguntas sobre
PHP">PHP</a></li>
</ul>
</div>
<li><a href="horarios.shtml" title="Horario de clase">Horario</a>
<ul>
<li><a href="horario1.shtml" title="Horario (Tablas)">Horario
(Tablas)</a></li>
<li><a href="horario2.shtml" title="Horario (Capas)">Horario
(Capas)</a></li>
</ul>
<li><a href="formularios.shtml" title="Formulario">Formularios</a>
<ul>
<li><a href="form_salida.shtml" title="Formulario -
Submit">Formularios (Haciendo el Submit)</a></li>
</ul>
<li><a href="imagen_0.shtml" title="Imagenes Inmenzas">Imagenes
Inmenzas</a>
<ul>
<li><a href="imagen_1.shtml" title="Imagenes
Inmenzas">Partiendo en una tabla</a></li>
<li><a href="imagen_2.shtml" title="Imagenes
Inmenzas">Con Celsspading=0</a></li>
<li><a href="imagen_3.shtml" title="Imagenes
Inmenzas">Con Border=0</a></li>
</ul>
<li><a href="javascript.shtml" title="JavaScript">Javascript</a>
<ul>
<li><a href="j_tabla.shtml" title="Tabla de Multiplicar
y mas...">Tabla de Multiplicar</a></li>
</ul>
</ul>
<hr/>
<center<a
href="mailto:ol************@yahoo.es">ol********** **@yahoo.es</a</center>
<hr/>
<form name="cambiando_estilos">
¿Cambiar a <select name="Seleccionar" onchange="Cambiar()">
<option value="estilo1.css"Estilo 1?
</option>
<option selected value="estilo2.css"Estilo 2? </option>
<option value="estilo3.css"Estilo 3? </option>
</select>
</form>
<hr/>