Forum Moderators: open
Basically, I have a page where users click on a link and a .jpeg is loaded into a small iframe and automatically resized. The Javascript that does this is:
function showimageinframe(imagelink,framename,width,height) {
/* function showimageinframe by Sathallrin */
var source = '<img width="'+width+'" height="'+height+'" src="'+imagelink+'" />';
var myframe = document.getElementById(framename).contentWindow.document;
myframe.open();
myframe.write(source);
myframe.close();
}
Is there something in IE 5.14 that would prevent this from working properly or could it be to do with the Mac?
Many thanks.
The iframe, in this case will bring in it's own document (no document.write), which consists of the usual html, a transparent image (id="placer"), and a smal script:
function showImage(src, width, height)
{
var placer = document.getElementById('placer');
placer.src = src;
placer.width = width;
placer.height = height;
}
Now the main page function becomes:
function showimageinframe(src,framename,width,height)
{
document.frames[framename].showImage(src, width, height);
}
In fact, if you don't specify the dimensions of the placer image, then you could cut out the passing & setting of width & height, and let each image sort itself out.