<script>
if _i.height<_i.width then
document.write ("<img src='oficina.JPG' width='100' height='150'>")
else
document.write ("<img src='oficina.JPG' width='150' height='100'>")
end if
</script>
no hace lo q le pido ¿esta bien?
| |||
esta bien esta linea?? <script> if _i.height<_i.width then document.write ("<img src='oficina.JPG' width='100' height='150'>") else document.write ("<img src='oficina.JPG' width='150' height='100'>") end if </script> no hace lo q le pido ¿esta bien? Última edición por suntus; 13/09/2004 a las 04:12 |
| |||
gracias javierb pero no me va este script haber si alguien me da una ayudita <html> <body> <script type="text/javascript"> var _i = new Image(); _i.src="oficina.jpg"; document.write("El tamaño de la imagen 'oficina.jpg' es: "); document.write(_i.width+'x'+_i.height); </script> </b></p> <p> <script> if (_i.height < _i.width) then document.write ("<img src='oficina.JPG' width='100' height='150'>") else document.write ("<img src='oficina.JPG' width='150' height='100'>") end if </script> </p> </body> </html> me dice las dimensiones pero no me muestra la foto luego en el if |
| ||||
no soy muy experto sobre el tema, pero una vez tuve problemas por usar apostofres ( '' ) en vez de comillas ( "" ), proba cambiandolos a ver q pasa... Suerte.! ![]()
__________________ IntoXicadoS -- Rock Argentina "Cuando estes triste ponete a pensar, la solucion en vos esta..." edi! |
| ||||
Pon: <script> if (_i.height < _i.width){ document.write ("<img src='oficina.JPG' width='100' height='150'>") } else{ document.write ("<img src='oficina.JPG' width='150' height='100'>") } </script> Otra forma sería: <script> x=(_i.height < _i.width)?100:150; y=(_i.height < _i.width)?150:100; document.write("<img src='oficina.JPG' width='"+x+"' height='"+y+"'>"); </script> Pero la primera funcionará estupendamente.
__________________ Cómo escribir No hay pregunta tonta, sino tonto que quiere seguir en la ignorancia. |
| ||||
Cita:
Iniciado por caricatos No entiendo como se le pasó a JavierB lo de "then"... Es sintaxis Basic (o asp, o visual Basic... pero no javascript). ![]() Saludos, ![]() |
| ||||
Me alegro de que te funcione! JavierB... estás de lo más políglota ![]()
__________________ Cómo escribir No hay pregunta tonta, sino tonto que quiere seguir en la ignorancia. |