Foros del Web » Programando para Internet » Javascript »

Donde esta el fallo?

Estas en el tema de Donde esta el fallo? en el foro de Javascript en Foros del Web. Tengo el siguiente codigo, pero me da error de script, alguien sabe donde esta el fallo? :( //////////////////// VARIABLES ////////////////////// var VHeight = 300; var ...
  #1 (permalink)  
Antiguo 01/09/2007, 09:06
Avatar de mdk
mdk
 
Fecha de Ingreso: noviembre-2002
Mensajes: 531
Antigüedad: 21 años, 5 meses
Puntos: 11
Donde esta el fallo?

Tengo el siguiente codigo, pero me da error de script, alguien sabe donde esta el fallo? :(


//////////////////// VARIABLES //////////////////////
var VHeight = 300;
var VWidth = 700;

/////////////////// FUNCIONES ///////////////////////
function ventana() {
Obj = document.getElementById("ventana");
Obj.style.visibility = "visible";
Obj.style.left = (document.body.clientHeight / 2) - (VWidth / 2);
Obj.style.top = (document.body.clientWidth / 2) - (VHeight / 2);
Obj.style.width = VWidth;
Obj.style.height = VHeight;
FObj = document.getElementById("fondo");
FObj.style.visibility = "visible";
FObj.style.width = document.body.scrollWidth;
FObj.style.height = document.body.scrollHeight;
}
function sombra() {
SbRight = document.getElementById("SbRight");
SbRight.style.visibility = "visible";
SbRight.style.left = (document.body.clientHeight / 2) + (VWidth / 2);
SbRight.style.top = (document.body.clientWidth / 2) - (VHeight / 2) + 15;
SbRight.style.width = 15;
SbRight.style.height = (VHeight / 2) + 15;
}
__________________
SoY Lo Ke VeS iNKLuSo KuAnDo No Me VeS ;)
  #2 (permalink)  
Antiguo 01/09/2007, 15:14
Avatar de mdk
mdk
 
Fecha de Ingreso: noviembre-2002
Mensajes: 531
Antigüedad: 21 años, 5 meses
Puntos: 11
Re: Donde esta el fallo?

Nadie sabe donde puede estar el fallo?¿ :S
__________________
SoY Lo Ke VeS iNKLuSo KuAnDo No Me VeS ;)
  #3 (permalink)  
Antiguo 01/09/2007, 20:44
Avatar de FabianSN  
Fecha de Ingreso: enero-2007
Ubicación: SNicolas, BsAs, Argentina
Mensajes: 96
Antigüedad: 17 años, 3 meses
Puntos: 2
Re: Donde esta el fallo?

Cita:
Iniciado por mdk Ver Mensaje
Tengo el siguiente codigo, pero me da error de script, alguien sabe donde esta el fallo? :(


//////////////////// VARIABLES //////////////////////
var VHeight = 300;
var VWidth = 700;

/////////////////// FUNCIONES ///////////////////////
function ventana() {
Obj = document.getElementById("ventana");
Obj.style.visibility = "visible";
Obj.style.left = (document.body.clientHeight / 2) - (VWidth / 2);
Obj.style.top = (document.body.clientWidth / 2) - (VHeight / 2);
Obj.style.width = VWidth;
Obj.style.height = VHeight;
FObj = document.getElementById("fondo");
FObj.style.visibility = "visible";
FObj.style.width = document.body.scrollWidth;
FObj.style.height = document.body.scrollHeight;
}
function sombra() {
SbRight = document.getElementById("SbRight");
SbRight.style.visibility = "visible";
SbRight.style.left = (document.body.clientHeight / 2) + (VWidth / 2);
SbRight.style.top = (document.body.clientWidth / 2) - (VHeight / 2) + 15;
SbRight.style.width = 15;
SbRight.style.height = (VHeight / 2) + 15;
}
La verdad que no conozco demasiado de javascript, pero me parece que la propiedad .style.visibility deberia tner un valor de true si es como en otro lenguajes, si no es eso lo siento.
Saludos.
__________________
Letra de Canciones
  #4 (permalink)  
Antiguo 01/09/2007, 22:46
Avatar de derkenuke
Colaborador
 
Fecha de Ingreso: octubre-2003
Ubicación: self.location.href
Mensajes: 2.665
Antigüedad: 20 años, 6 meses
Puntos: 45
Re: Donde esta el fallo?

A primera vista yo no he visto errores.

Pruébalo en FF y comentanos qué te dice su consola de errores, porque es probable que el error no se encuentre en esas líneas (o danos un código completo de esa zona que poder ejecutar).

Un saludo.
__________________
- Haz preguntas inteligentes, y obtendrás más y mejores respuestas.
- Antes de postearlo Inténtalo y Búscalo.
- Escribe correctamente tus mensajes.
  #5 (permalink)  
Antiguo 01/09/2007, 23:29
Avatar de demiurgo_daemon  
Fecha de Ingreso: diciembre-2006
Ubicación: Querétaro
Mensajes: 184
Antigüedad: 17 años, 4 meses
Puntos: 2
Re: Donde esta el fallo?

Hola,

todas las propiedades numéricas (style.left, style.width, etc.) deben tener unidades. Por ejemplo, es incorrecto escribir

Código:
Obj.style.width = VWidth;
debe ser

Código:
Obj.style.width = VWidth+"px";
En otras palabras, debes concatenar la unidad a la que te refieres, como en CSS. Si después de esto sigues con errores, para eso es la consola de errores de Firefox .

saludos
  #6 (permalink)  
Antiguo 02/09/2007, 06:49
Avatar de mdk
mdk
 
Fecha de Ingreso: noviembre-2002
Mensajes: 531
Antigüedad: 21 años, 5 meses
Puntos: 11
Re: Donde esta el fallo?

Gracias demiurgo_daemon (ke nombre mas largo puff, xD) lo probare a ver :D
__________________
SoY Lo Ke VeS iNKLuSo KuAnDo No Me VeS ;)
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 21:30.