Ver Mensaje Individual
  #3 (permalink)  
Antiguo 23/07/2009, 10:03
mario798
Usuario no validado
 
Fecha de Ingreso: abril-2009
Ubicación: España
Mensajes: 96
Antigüedad: 15 años
Puntos: 0
Pregunta Respuesta: Agrandar Imagenes

Cita:
Iniciado por Adler Ver Mensaje
Hola

La teoría puede ser algo como esto. Tienes una imagen de tamaño 100x100. En un principio la muestras con un tamaño de 50x50 y después con + o - se irá aumentando o disminuyendo. Solo podrá aumentar hasta 100x100, para que la imagen no quede distorsionada.

Tendrás que trabajar con el width y el height de la imagen
Código html:
Ver original
  1. <img src="image.gif" id="mesa" width="50px" height="50px" /><br/>
  2. <input type="button" value="+" onclick="redimensionar('sumar') /><br/>
  3. <input type="button" value="-" onclick="redimensionar() />
La función sería así

Código javascript:
Ver original
  1. function redimensionar (accion) {
  2. var height, width
  3. if (accion == "sumar") {
  4. height += 10;
  5. width + = 10;
  6. document.getElementById("mesa").style.height = height + "px"
  7. document.getElementById("mesa").style.width = width + "px"
  8. }
  9. else
  10. {
  11. height -=10;
  12. widht -= 10;
  13. document.getElementById("mesa").style.height = height + "px"
  14. document.getElementById("mesa").style.width = width + "px"
  15. }
  16. }

Suerte

Perdona esque la funcion me da error nose porke sera alomejor esque esta algo mal puesto pero nose...lo de (accion)que haría?

Saludos