Does anyone know how to resize images proportionally using JavaScript?
I have tried to modify the DOM by adding attributes height and width
height
width
Tried the following code, worked OK on IE6 on WinXP Pro SP3.
function Resize(imgId) { var img = document.getElementById(imgId); var w = img.width, h = img.height; w /= 2; h /= 2; img.width = w; img.height = h; }
Also OK in FF3 and Opera 9.26.