Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/08/2008, 06:08
capitanquartz
 
Fecha de Ingreso: julio-2008
Mensajes: 28
Antigüedad: 15 años, 10 meses
Puntos: 0
crear valores en CSS por javascript

Buenas.

Estoy usando un efecto Ajax el cual debe tener una dimensión width en su CSS, pero si esta es un porcentaje el Ajax deja de funcionar. Por ello, se me ocurre una solución aunque mis conocimientos de Javascript son practicamente nulos y no se que falla. Aqui un codigo de lo que tengo:
Código:
<script type="text/javascript">
 var ancho =  screen.width
 entrecien = ancho / 100;
porveinte = entrecien * 20;
resultado = ancho - porveinte
document.write('
<style type="text/css">
div#my-glider-horizontal div.scroller { 
	/* modify width and height of scrolling section if necessary	*/		
	width: '+ resultado +'px; 
	height: 100%;
	overflow: hidden;

	}
	div#my-glider-horizontal div.scroller div.section {
		/* modify width and height of each section as needed (should match the size of the scroller window)	*/	

		width: '+ css +'px;
		height:100%;
		overflow:hidden;
		float:left;
		padding:1em;		
		}
	div#my-glider-horizontal div.scroller div.content {
		width: 10000px;
		}
	div#my-glider-horizontal div#section2 {
		background:#ffffff;
		color:#ffffff;
		}
</style>
');		
</script>
bueno, a ver si algun entendido del tema me puede hechar una mano XD

Gracias y un saludo