Bueno esta es una funcion que se me ocurrio hacer :
Si Porcentaje es igual a true entonces el ancho y el alto son los porcentajes. si es igual a false los anchos y alto son los definidos.
Código Javascript
:
Ver originalfunction Cuenta(Alto,Ancho,Porcentaje){
/* --- Variables --- */
var Imagen = document.getElementsByTagName('img'); /* -- Etiquetas Imagen -- */
/* --- Bucle para imagenes --- */
for(var i=1; i<Imagen.length; i++){
if(Porcentaje){
var Width = Imagen[this.length].width; /* -- Ancho de las etiquetas -- */
var Height = Imagen[this.length].height; /* -- Alto de las etiquetas -- */
var Altura = Height*Alto/100;
var Anchura = Width*Ancho/100;
Imagen.width=Altura;
Imagen.height=Anchura;
}else{
Imagen.width=Alto;
Imagen.height=Ancho;
}
}
}
Código HTML:
Ver original<!DOCTYPE html>
<script type="application/javascript" language="javascript" src="javascript.js" /></script> <input type="button" onclick="Cuenta(25,50,'true');" value="Cuenta" /> <img src="http://l.yimg.com/cv/ip/ap/default/120224/0224_lucas_ml.jpg" name="img" />
el echo es que no se por que no anda ;S