Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/02/2007, 19:59
erponcios
 
Fecha de Ingreso: abril-2006
Mensajes: 218
Antigüedad: 18 años, 11 meses
Puntos: 0
Cambiar background dependiendo la resolución del cliente.

Buenas gente.

Aquí tengo un código que les muestro que sirve para cambiar la resolución dependiendo la que tenga el cliente.

<body>

<script language="JavaScript">

if (screen.width + "x" +screen.height == "800x600") document.body.style.backgroundImage = "url(fondo8.jpg)";
if (screen.width + "x" +screen.height == "1024x768") document.body.style.backgroundImage = "url(fondo10.jpg)";
if (screen.width + "x" +screen.height == "1280x1024") document.body.style.backgroundImage = "url(fondo12.jpg)";
if (screen.width + "x" +screen.height == "1600x1200") document.body.style.backgroundImage = "url(fondo16.jpg)";

</script>


El problema esta, en que en algunos ordenador va y en otro no... no se porque.

Mi pregunta es si sabeís si hay alguna otra forma de hacerlo con alguna otra propiedad para probar a ver si va en todos los ordenadores.

Un saludo y muchas gracias de ante mano.