Programación Web y Scripting > JavaScript
Sintaxis Javascript En Firefox
EGunther:
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:
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
lencho:
creo que este post deberia estar en el foro de JavaScript.
movido !!!.
BYTE.
Altareum:
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.
EGunther:
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.
Navegación
[#] Página Siguiente
Ir a la versión completa