Lo he intentando hacer así pero no me funciona:
- En el head
Código:
-En el body:<script type="text/javascript"> function changeImages() { var ancho = screen.width; if (parseInt(ancho) < parseInt(1280)) { document.getElementById("img1").src="fotos/vacaloura001mini.jpg"; document.getElementById("img2").src="fotos/vacaloura002mini.jpg"; document.getElementById("img3").src="fotos/vacaloura003mini.jpg"; document.getElementById("img4").src="fotos/vacaloura004mini.jpg"; document.getElementById("img5").src="fotos/vacaloura005mini.jpg"; }else { document.getElementById("img1").src="fotos/vacaloura001.jpg"; document.getElementById("img2").src="fotos/vacaloura002.jpg"; document.getElementById("img3").src="fotos/vacaloura003.jpg"; document.getElementById("img4").src="fotos/vacaloura004.jpg"; document.getElementById("img5").src="fotos/vacaloura005.jpg"; } } </script>
Código:
Estoy haciendo algo mal? o existe alguna forma más sencilla de hacerlo?<body onload="javascript:changeImages()"> .... .... .... <div id="SliderName_2"> <img id="img1" src="fotos/vacaloura001.jpg" alt="Vacaloura" title="Vacaloura" /> <img id="img2" src="fotos/vacaloura002.jpg" alt="Vacaloura" title="Vacaloura" /> <img id="img3" src="fotos/vacaloura003.jpg" alt="Vacaloura" title="Vacaloura" /> <img id="img4" src="fotos/vacaloura004.jpg" alt="Vacaloura" title="Vacaloura" /> <img id="img5" src="fotos/vacaloura005.jpg" alt="Vacaloura" title="Vacaloura" /> <div id="SliderNameNavigation_2"></div> <script type="text/javascript"> <!--effectsDemo2 = 'rain,stairs,fade';--> effectsDemo2 = 'fade'; var demoSlider_2 = Sliderman.slider({container: 'SliderName_2', width: 1225, height: 539, effects: effectsDemo2, display: { autoplay: 3000, autostart: false, first_slide: true, loading: {background: '#000000', opacity: 0.5, image: 'fotos/loading.gif'}, buttons: {hide:true, opacity:1, prev:{className:'SliderNamePrev_2', label:''},next:{className:'SliderNameNext_2', label:''}}, navigation: {container: 'SliderNameNavigation_2', label: '<img src="fotos/clear.gif" />'} } }); </script> </div> .... .... ....
Gracias.