M
Mike McCollister
I have a JavaScript function that I use to open up an image in a popup
window when someone clicks on an image. It works fine in IE6 but in IE7 when
I try to do a resizeBy to resize the window due to the scrollbar height the
image does not come up sometimes. Does anyone know how to fix this?
I've included my function. below.
Thanks,
Mike
function DisplayImage(image, width, height, title, date)
{
var newWin;
var winName;
var title2 = unescape(title);
var newTitle = title2;
var newDate;
var ieVersion = GetInternetExplorerVersion();
html = "";
title2 = "some code remove here";
html += "<html>" + endl;
html += "<head>" + endl;
html += "<title>" + newTitle + ": " + newDate + "</title>" + endl;
html += "</head>" + endl;
html += "<script>" + endl;
html += "function PlaySound(url) {html += document.all.sound.src =
url;}";
html += "</script>" + endl;
html += "<body bgcolor='#FFFFFF' topmargin='0' leftmargin='0' " +
"marginheight='0' marginwidth='0'>" + endl;
html += "<p align='center'>" + endl;
html += "<a href='javascript:window.close()'>" +
"<img src='" + imageDir + "/" + image + "' width='" + width +
"' height='" + height + "' alt='' " +
"title='Click to Close Window' border='0'></a>" + endl;
html += "</p>" + endl;
html += "<font face='Arial'>" + endl;
html += "<p align='center'><b>" + title2 + "</b><br>" + endl;
html += date + "</p><p></p>" + endl;
html += "</font>" + endl;
html += "</body>" + endl;
html += "</html>";
newWin = window.open("", "photoWindow", //winName,
"width=" + width +
",height=" + height +
",menubar=yes" +
",resizable=yes" +
",scrollbars=yes",
true);
// resize window only for Microsoft Internet Explorer
if(navigator.appName == "Microsoft Internet Explorer")
{
// ???? PROBLEMS HERE IN IE7 ?????
if((ieVersion >= 4) && (ieVersion <= 6))
{
// I don't know why this needs to be done
newWin.document.writeln("<html><body></body></html>");
// do the resize
newWin.resizeBy(width - newWin.document.body.clientWidth,
height - newWin.document.body.clientHeight);
}
}
newWin.document.writeln(html);
newWin.document.close();
newWin.focus();
}
window when someone clicks on an image. It works fine in IE6 but in IE7 when
I try to do a resizeBy to resize the window due to the scrollbar height the
image does not come up sometimes. Does anyone know how to fix this?
I've included my function. below.
Thanks,
Mike
function DisplayImage(image, width, height, title, date)
{
var newWin;
var winName;
var title2 = unescape(title);
var newTitle = title2;
var newDate;
var ieVersion = GetInternetExplorerVersion();
html = "";
title2 = "some code remove here";
html += "<html>" + endl;
html += "<head>" + endl;
html += "<title>" + newTitle + ": " + newDate + "</title>" + endl;
html += "</head>" + endl;
html += "<script>" + endl;
html += "function PlaySound(url) {html += document.all.sound.src =
url;}";
html += "</script>" + endl;
html += "<body bgcolor='#FFFFFF' topmargin='0' leftmargin='0' " +
"marginheight='0' marginwidth='0'>" + endl;
html += "<p align='center'>" + endl;
html += "<a href='javascript:window.close()'>" +
"<img src='" + imageDir + "/" + image + "' width='" + width +
"' height='" + height + "' alt='' " +
"title='Click to Close Window' border='0'></a>" + endl;
html += "</p>" + endl;
html += "<font face='Arial'>" + endl;
html += "<p align='center'><b>" + title2 + "</b><br>" + endl;
html += date + "</p><p></p>" + endl;
html += "</font>" + endl;
html += "</body>" + endl;
html += "</html>";
newWin = window.open("", "photoWindow", //winName,
"width=" + width +
",height=" + height +
",menubar=yes" +
",resizable=yes" +
",scrollbars=yes",
true);
// resize window only for Microsoft Internet Explorer
if(navigator.appName == "Microsoft Internet Explorer")
{
// ???? PROBLEMS HERE IN IE7 ?????
if((ieVersion >= 4) && (ieVersion <= 6))
{
// I don't know why this needs to be done
newWin.document.writeln("<html><body></body></html>");
// do the resize
newWin.resizeBy(width - newWin.document.body.clientWidth,
height - newWin.document.body.clientHeight);
}
}
newWin.document.writeln(html);
newWin.document.close();
newWin.focus();
}