Tema: funcion with
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/01/2010, 02:10
Avatar de caricatos
caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años
Puntos: 1284
Respuesta: funcion with

Hola:

Se trata de un selector de objetos,y ayuda para hacer algo más legible y reducido el código... por ejemplo, si se quiere modificar varios estilos del body, la sintaxis con with sería así:

with(document.body.style) {
color = "red";
background = "blue url(fondo.img) no repeat center top";
textAlign = "justify";
textIndent = "1em";
// etc, etc.
}

esto también podría ponerse

with(document) with(body) with(style) {
// aquí los estilos...
}

O sea vale para objetos y atributos (eso que se escribe con los puntos...)

Saludos
__________________
Por favor:
No hagan preguntas de temas de foros en mensajes privados... no las respondo