Hi,
I had a few problems making a Javascript work, whatever I did worked on either netscape on windows not, or IE on Mac not etc.
I found a solution by using PHP, which is certainly not the cleanest, but it works. I would appreciate it if you guys check it out and give me any suggestions! Here the script:
<SCRIPT language="JavaScript">
<!-- hide this script from old browsers
var newWindow = null;
var picture;
var windowTitle;
var options = 'toolbar=0,location=0,directories=0,top=0,left=50,status=0,menubar=0,scrollbars=0,resizable,height=385,width=230';
function popup(picture,windowTitle) {
<?PHP if ((strstr (getenv('HTTP_USER_AGENT'), 'Mac')) && (strstr (getenv('HTTP_USER_AGENT'), 'MSIE'))) {
$badBrowser = 1;
}
if (!$badBrowser) { ?>
function closeIt() {
if (newWindow != null) {
if (!newWindow.closed) {
newWindow.close();
}
}
}
closeIt();
<?PHP } ?>
newWindow = window.open('','',options);
with (newWindow.document) {
open();
write('\n<HEAD>\n<TITLE>' + windowTitle + '</TITLE>\n</HEAD>');
write('<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<TABLE ALIGN="center" BORDER=0 CELLSPACING=0 CELLPADDING=0 VALIGN="MIDDLE">\n<TR>');
write('<TD align="center"><IMG SRC="'+picture+'" BORDER=0 ALT="'+windowTitle+'"><BR><BR>');
write('<A href="Javascript:window.close()"><IMG src="img/closewindow.gif" border="0"></A></TD>');
write('</TR>\n</TABLE>\n</BODY>\n');
close();
}
}
// stop hiding -->
</SCRIPT>
as you can see, it opens a new window, and the closeIt function is the problem on Macs IE. But I didn't want to take it out completly, because it's a nice little feature that when opening another new window, the first new window closes.
Any suggestions?
DrTebi