Csaba Gabor wrote:
[color=blue]
> I have an IMG placeholder for what will normally be a tiny (6x7) img.
> Sometimes however, I will use a somewhat larger but still small image.
> How can I unset the dimensions for the <IMG id=normallyTiny ...>
> element I have already specified, rather than using the tortured code
> below? Unfortunately, I must set the dimensions at the outset, because
> otherwise the placeholder for the 'normallyTiny' image will be too big.[/color]
That is difficult to achieve I think as browsers behave differently, if
you only care about modern browsers then the best approach is to create
a new image element e.g.
var img = document.createElement('img');
// set src as needed
img.src = 'whatever.gif';
and then replace the other image element e.g.
var oldImg = document.getElementById('normallyTiny');
if (oldImg && oldImg.parentNode && oldImg.parentNode.replaceChild) {
oldImg.parentNode.replaceChild(img);
}
--
Martin Honnen
http://JavaScript.FAQTs.com/