473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Where is the mistake? <UL> + style.display

Where is the mistake?

I want to make a simple menu. These are two pieces of two files...

function ShowMenu(objeto) {
is_open = document.getElementById(objeto).style.display;
document.getElementById("menu_p").style.display='n one';
if (is_open == 'none') {
document.getElementById(objeto).style.display='blo ck';
}
else {
document.getElementById(objeto).style.display='non e' ;
}
}
..
..
..
<li><a href="preguntas.shtml" onclick="ShowMenu('menu_p')"
title="P">Preguntas</a></li>
<ul id="menu_p" style="display='none'">
<li><a href="preg_html.shtml">HTML</a></li>
<li><a href="preg_css.shtml"">CSS</a></li>
<li><a href="preg_javascript.shtml">JavaScript</a></li>
<li><a href="preg_php.shtml">PHP</a></li>
</ul>
<li>
..
..
Dec 8 '06 #1
4 2158
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.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 8 '06 #2
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>
Dec 8 '06 #3
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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Dec 8 '06 #4
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/>
Dec 8 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: bearclaws | last post by:
I am looping through a list of categories and want to display the list horizontally (instead of vertically). I want to create a single row with 4 list items in each cell of the row. I thought...
1
by: Randall Sell | last post by:
OK, I am utterly stumped. The code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <style type="text/css"> ul {...
5
by: toylet | last post by:
Attached is some css codes for a website. It has 3 parts: top-bar, side-bar (on the left) and main-body. The top-bar has a mouseover menu called top-menu implemented via ul:hover. When the mouse...
4
by: Matt | last post by:
Hi, Got an unordered list with 100% width, with 5 list items of 20% width styled to fill the width of the container element. Renders fine in Mozilla, but when you change the size of the window...
16
by: michael | last post by:
Is it possible to get all href URLs contained in a unordered list and place them in an array? Or in fact two different arrays, differently named one for each <ul> group? <ul> <li><a...
2
by: Shaun | last post by:
Hello! I have a quick question regarding CSS and having it applied to all elements. I am trying to eliminate the gap between a paragraph and a list that usually occurs in html and I've found...
5
by: Syl | last post by:
Hello experts!! The top menu navigation bar displays perfectly in IE, but does not display properly in Mozilla or Netscape : http://checkeredshirt.com/textonly.html For some reason the non-IE...
2
by: cityman007 | last post by:
Hi Somebody help me to solve the problem with <ul><li> with images. I used images with Hspace and Vspace and beside the images i make list. its overlapping in Firefox and not seen in IE7 ...
2
by: Shahid | last post by:
Hi, I am parsing an .HTML file that contains following example code: <div> <p class="html_preformatted" awml:style="HTML Preformatted" dir="ltr" style="text-align:left"><span...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.