javascript popup on mac
Posted: Tue Feb 24, 2004 7:57 pm
I've written the following javascript code to create a popup window for viewing a graphic image. Code as follows:
<!-- JavaScript file contents
<!-- This JavaScript function will popup a window for fullsize
<!-- viewing of an image file that is passed from calling routine
function PopupImageViewer(image_file){
photo = new Image();
photo.src = image_file;
CheckImageFile(image_file);
}
function CheckImageFile(image_file){
if((photo.width!=0)&&(photo.height!=0)){
ViewPhoto(image_file);
} else{
// In the event the file is new, need to resend image to this routine
resend="CheckImageFile('"+image_file+"')";
interval=setTimeout(resend,20);
}
}
function ViewPhoto(image_file){
// Need to add 25 pixel border around image for viewing on PC and MACS
win_w=photo.width+25;
win_h=photo.height+100;
win_l=(screen.width - photo.width) / 2
win_t=(screen.height - photo.height) / 2
scroll_option = "no"
resize_option = "no"
window_attributes = "toolbar=no,location=no,directories=no,status=no,menubar=no,"
window_attributes += "width="+win_w+",height="+win_h+",top="+win_t+",left="+win_l+",scrollbars="+scroll_option+",resizable="+resize_option;
view_image=window.open(image_file,"ImageViewer",window_attributes)
view_image.document.open()
view_image.document.write('<html>')
view_image.document.write('<head>')
view_image.document.write('<title>Image Viewer</title>')
view_image.document.write('</head>')
// In case we want some text above the image or a specific body color
// view_image.document.write('<body bgcolor="white"><h3>Image Viewer</h3>')
// view_image.document.write('</p>')
// view_image.document.write('</body>')
// In case we want a CANCEL button to close the window
view_image.document.write('</html>')
view_image.document.write('<img src="'+image_file+'">')
view_image.document.write('</p>')
view_image.document.write('<center><INPUT TYPE=button NAME="CLOSE" VALUE="CLOSE" onClick="self.close()"></center>');
view_image.document.close()
// If the popup window goes beneath the main window, this will
// bring it to the top
view_image.resizeTo(win_w,win_h); // absolute positioning
view_image.window.focus();
}
This works fine on Windows XP (Internet Explorer) but doesn't work at all on Mac OS (Internet Explorer).
Any ideas??
thanx
crandym
<!-- JavaScript file contents
<!-- This JavaScript function will popup a window for fullsize
<!-- viewing of an image file that is passed from calling routine
function PopupImageViewer(image_file){
photo = new Image();
photo.src = image_file;
CheckImageFile(image_file);
}
function CheckImageFile(image_file){
if((photo.width!=0)&&(photo.height!=0)){
ViewPhoto(image_file);
} else{
// In the event the file is new, need to resend image to this routine
resend="CheckImageFile('"+image_file+"')";
interval=setTimeout(resend,20);
}
}
function ViewPhoto(image_file){
// Need to add 25 pixel border around image for viewing on PC and MACS
win_w=photo.width+25;
win_h=photo.height+100;
win_l=(screen.width - photo.width) / 2
win_t=(screen.height - photo.height) / 2
scroll_option = "no"
resize_option = "no"
window_attributes = "toolbar=no,location=no,directories=no,status=no,menubar=no,"
window_attributes += "width="+win_w+",height="+win_h+",top="+win_t+",left="+win_l+",scrollbars="+scroll_option+",resizable="+resize_option;
view_image=window.open(image_file,"ImageViewer",window_attributes)
view_image.document.open()
view_image.document.write('<html>')
view_image.document.write('<head>')
view_image.document.write('<title>Image Viewer</title>')
view_image.document.write('</head>')
// In case we want some text above the image or a specific body color
// view_image.document.write('<body bgcolor="white"><h3>Image Viewer</h3>')
// view_image.document.write('</p>')
// view_image.document.write('</body>')
// In case we want a CANCEL button to close the window
view_image.document.write('</html>')
view_image.document.write('<img src="'+image_file+'">')
view_image.document.write('</p>')
view_image.document.write('<center><INPUT TYPE=button NAME="CLOSE" VALUE="CLOSE" onClick="self.close()"></center>');
view_image.document.close()
// If the popup window goes beneath the main window, this will
// bring it to the top
view_image.resizeTo(win_w,win_h); // absolute positioning
view_image.window.focus();
}
This works fine on Windows XP (Internet Explorer) but doesn't work at all on Mac OS (Internet Explorer).
Any ideas??
thanx
crandym