Resizing image using Javascript in IE and FireFox

A couple of weeks ago, I wrote the following code to resize an image with javascript:

imgnode.style.width= parseInt(imgnode.style.width) + 20;
imgnode.style.height = parseInt(imgnode.style.width) + 20;

This works perfect in IE. But does not work at all in FireFox. Then I changed it to:

var width = parseInt(imgnode.style.width);
var height = parseInt(imgnode.style.height);
width = width – 20;
height = height – 20;
imgnode.style.width= width + “px”;
imgnode.style.height = height + “px”;

This works great in FireFox and IE.




Copyright (c) 2007-2017 Ashish Patil . Please read FAQ for more details.

comments powered by Disqus