Forum Moderators: open
function openwindow(img,w,h,caption) {
var day = new Date();
var id = day.getTime();
// add some padding for the window
var winwidth=w+25;
var winheight=h+50;
var params =
'status,resizable,width='+winwidth+',height='+winheight;
var msg=
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"'
+ ' "http://www.w3.org/TR/html4/loose.dtd">\n'
+ '<html lang="en">\n'
+ '<head><title>'+caption+'<\/title>\n'
+ '<body><img src="'+img+'"width="'+w+'" height="'+h+'" border="0" >\n'
+ '<form style="text-align:center">\n'
+ '<input type="button" onClick="window.close();" value="Close Window">\n'
+ '<\/form>\n'
+ '<\/body>\n'
+ '<\/html>\n';
var win = window.open(img,id,params)
win.document.write(msg);
win.document.close();
return false;
}
It works just fine in FireFox, Opera, and Chrome. But in IE8 (regular or compatibility mode)it hangs at " win.document.write(msg); " with the message Object Required".
Any suggestions as how to fix it?
Many thanks,
MartinL