• Jueves 2 de Mayo de 2024, 02:40

Autor Tema:  Sintaxis Javascript En Firefox  (Leído 4304 veces)

EGunther

  • Nuevo Miembro
  • *
  • Mensajes: 2
    • Ver Perfil
    • http://www.ecommercechile.cl
Sintaxis Javascript En Firefox
« en: Martes 5 de Febrero de 2008, 13:48 »
0
Estimados ya no se que hacer ni cual es el problema. al parecer mi sintaxis no es soportada por firefox o algo esta mal en mi codigo. Esto es un script que corre en una master.page, estoy desarrollando una aplicacion con csharp, pero estoy estancado con la sintaxis de javascript en firefox, he leido y buscado que lo correcto en firefox es usar:

window.document.getElementById('tab_about').style.height = 0;

Pero creo que algo estoy haciendo mal. Por favor me podrian ayudar y darme una mano?


function(s, e) {

var browserName=navigator.appName;
if (browserName=='Microsoft Internet Explorer')
{
alto_menu = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1'));
alto_tdmenu = GetHeight(window.document.getElementById('td_menu'));

a1 = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1_GHC0'));
a2 = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1_GHC1'));
a3 = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1_GHC2'));
a4 = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1_GHC4'));
a5 = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1_GHC5'));

window.document.getElementById('div_sir').style.height = 0;
window.document.getElementById('div_sgi').style.height = 0;
window.document.getElementById('div_sic').style.height = 0;
window.document.getElementById('div_rsf').style.height = 0;
window.document.getElementById('div_adm').style.height = 0;
window.document.getElementById('tab_about').style.height = 0;

window.document.getElementById('div_sir').style.height = alto_tdmenu - 160;
window.document.getElementById('div_sgi').style.height = alto_tdmenu - 160;
window.document.getElementById('div_sic').style.height = alto_tdmenu - 160;
window.document.getElementById('div_rsf').style.height = alto_tdmenu - 160;
window.document.getElementById('div_adm').style.height = alto_tdmenu - 160;
window.document.getElementById('tab_about').style.height = alto_tdmenu - 160;

window.document.getElementById('div_sir').style.width = 205;
window.document.getElementById('div_sgi').style.width = 205;
window.document.getElementById('div_sic').style.width = 205;
window.document.getElementById('div_rsf').style.width = 205;
window.document.getElementById('div_adm').style.width = 205;
window.document.getElementById('tab_about').style.width= 205;
}
else
{
alto_menu = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1'));
alto_tdmenu = GetHeight(window.document.getElementById('td_menu'));

a1 = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1_GHC0'));
a2 = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1_GHC1'));
a3 = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1_GHC2'));
a4 = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1_GHC4'));
a5 = GetHeight(window.document.getElementById('ctl00_ASPxNavBar1_GHC5'));

window.document.getElementById('div_sir').style.height = 0;
window.document.getElementById('div_sgi').style.height = 0;
window.document.getElementById('div_sic').style.height = 0;
window.document.getElementById('div_rsf').style.height = 0;
window.document.getElementById('div_adm').style.height = 0;
window.document.getElementById('tab_about').style.height = 0;

window.document.getElementById('div_sir').style.height = alto_tdmenu - 160;
window.document.getElementById('div_sgi').style.height = alto_tdmenu - 160;
window.document.getElementById('div_sic').style.height = alto_tdmenu - 160;
window.document.getElementById('div_rsf').style.height = alto_tdmenu - 160;
window.document.getElementById('div_adm').style.height = alto_tdmenu - 160;
window.document.getElementById('tab_about').style.height = alto_tdmenu - 160;

window.document.getElementById('div_sir').style.width = 205;
window.document.getElementById('div_sgi').style.width = 205;
window.document.getElementById('div_sic').style.width = 205;
window.document.getElementById('div_rsf').style.width = 205;
window.document.getElementById('div_adm').style.width = 205;
window.document.getElementById('tab_about').style.width = 205;
}

Se supone que dentro del else estaria la condicion de firefox u otro navegador, se que estoy generalizando mucho pero quiero probar con firefox, finalmente deje igual ambos casos tanto para Iexplorer como para firefox para que me puedan ayudar que cambiar, para IExplorer funciona perfecto.

Esto es parte de un control de menu vertical que se expande. El cual tiene 6 secciones "div_sir", "div_sgi", "div_sic","div_rsf","div_adm","tab_about"

Les agradezco de antemano por vuestro tiempo!

arielb

  • Moderador
  • ******
  • Mensajes: 771
  • Nacionalidad: pa
    • Ver Perfil
    • http://coder-pa.blogspot.com
Re: Sintaxis Javascript En Firefox
« Respuesta #1 en: Jueves 7 de Febrero de 2008, 01:48 »
0
hola, por un si acaso ya revisaste que esté activo la opción de javascrit revisa en los menús
Herramientas/opciones/Contenido/Activar Javascript
"Porque de tal manera amó Dios al mundo que dio a su hijo unigénito para que todo aquél que en él crea no se pierda mas tenga vida eterna"
Juan 3:16

http://coder-pa.blogspot.com

lencho

  • Miembro de PLATA
  • *****
  • Mensajes: 1076
    • Ver Perfil
Re: Sintaxis Javascript En Firefox
« Respuesta #2 en: Sábado 9 de Febrero de 2008, 20:46 »
0
creo que este post deberia estar en el foro de JavaScript.

movido !!!.


BYTE.
______________________________________________________________________________________
"No estoy de acuerdo con lo que dices, pero defenderé con mi vida tu derecho a expresarlo"

Altareum

  • Miembro MUY activo
  • ***
  • Mensajes: 327
    • Ver Perfil
    • http://www.avian.com.ar
Re: Sintaxis Javascript En Firefox
« Respuesta #3 en: Lunes 11 de Febrero de 2008, 13:09 »
0
Intenta con:

window.document.getElementById('tab_about').style.height = "0px";

Y dos cosas.. primero es C#, sharp, es una marca de electrodomésticos  :P ...

Y por otro lado, intenta, interiorizarte un poco más. Tanto Mozilla (y obvio, Firefox) como Opera, cumplen todos los estándares de la W3C, y a su vez tienen cosas de más (nunca de menos). Si en IE funciona, no es porque sea maravilloso, sino, porque hace lo que quiere.

Si te fijas en la página de la W3C, todo valor, debe tener una cifra entera o decimal, seguida de la unidad:
The format of a length value (denoted by <length> in this specification) is a <number> (with or without a decimal point) immediately followed by a unit identifier (e.g., px, em, etc.). After a zero length, the unit identifier is optional.

Eso significa, que lo que estás haciendo, puede funcionar, segú la permisividad del navegador, pero no tiene porque funcionar en todos los navegadores.


Altareum.
El postre!, el postre!, el postre!, el postre!, el postre!, el postre!.....
 | Klinka | Kiree | Avian |

EGunther

  • Nuevo Miembro
  • *
  • Mensajes: 2
    • Ver Perfil
    • http://www.ecommercechile.cl
Re: Sintaxis Javascript En Firefox
« Respuesta #4 en: Lunes 11 de Febrero de 2008, 13:23 »
0
Estimado, justamente el viernes hice eso que me estas apuntando de especificar en comillas y con la unidad px  y me funcionó. Agradezco mucho tu preocupación ya que si no lo hubiese logrado el viernes hoy con tu respuesta iba a estar igualmente solucionado.

Ivanzinho

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
Re: Sintaxis Javascript En Firefox
« Respuesta #5 en: Martes 12 de Febrero de 2008, 17:40 »
0
Disculpen, lo que pasa es que yo tengo un codigo Javascript que me funciona en Firefox, pero en Internet Explorer 6 funciona mal, es muy sencillo, es un menú desplegable que estoy haciendo, el codigo es este:

Código: Text
  1.  
  2. &#60;html&#62;
  3.  
  4.  
  5. &#60;!--estilos CSS--&#62;
  6. &#60;style type=&#34;text/css&#34;&#62;
  7. .submenu{visibility:hidden; position:absolute; border:solid; border-width:1px; border-color:black;}
  8. .menu{border:solid; border-width:1px; border-color:black;}
  9. body{font-family:Verdana; font-size:12px; cursor:default; color:#0033FF}
  10. &#60;/style&#62;
  11.  
  12.  
  13. &#60;!--Scripts en Javascript--&#62;
  14. &#60;script language=&#34;javascript&#34;&#62;
  15. function muestra(submenu,interruptor){
  16. objeto = document.all(submenu)
  17. if(interruptor&#62;0)
  18. objeto.style.visibility = 'visible';
  19. else
  20. objeto.style.visibility = 'hidden';
  21. }
  22. chello = 'ivan';
  23. &#60;/script&#62;
  24. &#60;body&#62;
  25.  
  26.  
  27. &#60;!--este es el menú--&#62;
  28. &#60;table class=&#34;menu&#34; onMouseOver=&#34;muestra(chello,1)&#34; onmouseout=&#34;muestra(chello,0)&#34;&#62;&#60;tr&#62;&#60;td&#62;Pase por encima de esto&#60;/td&#62;&#60;/tr&#62;&#60;/table&#62;
  29.  
  30.  
  31. &#60;!--este es el submenú--&#62;
  32. &#60;table id=&#34;ivan&#34; class=&#34;submenu&#34; onMouseOver=&#34;muestra(this.id,1)&#34; onMouseOut=&#34;muestra(this.id,0)&#34; style=&#34;LEFT: 13px; TOP: 33px&#34;&#62;
  33.   &#60;tr&#62;
  34.     &#60;td height=&#34;23&#34;&#62;Lo que hay que mostrar&#60;/td&#62;
  35.   &#60;/tr&#62;
  36. &#60;/table&#62;
  37. &#60;/body&#62;
  38. &#60;/html&#62;
  39.  
  40.  

Pero pues el menú se corre en el Internet Explorer 6, ahora bien, estoy intentando que cuando se despliegue el submenú, y el mouse este fuera del area, el menú se oculte a los 1000ms, pero no lo hace nunca con un setTimeout(), ¿alguien me quiere colaborar con esto por favor?

Muchas gracias!! :D