javascript popup on mac

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
crandym
Forum Newbie
Posts: 21
Joined: Thu Jan 29, 2004 8:52 am

javascript popup on mac

Post by crandym »

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
ilovetoast
Forum Contributor
Posts: 142
Joined: Thu Jan 15, 2004 7:34 pm

Post by ilovetoast »

Do you have it online somewhere? If you don't I have to make up some images just to check it out as the syntax is ok.
crandym
Forum Newbie
Posts: 21
Joined: Thu Jan 29, 2004 8:52 am

Post by crandym »

Unfortunately I do not have this on-line anywhere. It works fine on my system, but it doesn't work on one of our associates computer who uses a Mac (in another state).

Wish I were able to debug it there.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

What version of IE on the Mac are you using? Traditionally, IE was crap for support of anything other than HTML and embedded objects. My advice would be to tell your co-worker to move to Safari, Firefox, or Camino. While this would possibly get around your problem, it would also reduce the number of problems in the future. IE on the Mac will ALWAYS have problems showing pages that aren't 100% standards compliant. Changing browsers will make your and your co-worker's lives much simpler. (Plus IE on the Mac is not longer supported by Microsoft)
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

aren't 100% standards compliant
mozilla is standards complient

if you write complient code, you won't have problems

change your code, not your targetted audience.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

LiLpunkSkateR wrote: change your code, not your targetted audience.
That may be true for him, but no matter how we evangalize, there will always be pages on the net that aren't standards compliant. That's why I would recommend changing browsers.

(Sorry if this is getting off topic.)
ilovetoast
Forum Contributor
Posts: 142
Joined: Thu Jan 15, 2004 7:34 pm

Post by ilovetoast »

As an old school Mac evangelista, I would say check things out in Safari. If it works in Safari, don't worry about it. IE on the Mac is abandoned. It lags so far behind the PC version and behind the other Mac browsers as to border on unusable. Safari other non-IE browsers now constitue the MacOSX user's web browser of choice by a substantial margin. And OS9 users can't really have any realistic expectation offorward compatibility at this point.
ilovetoast
Forum Contributor
Posts: 142
Joined: Thu Jan 15, 2004 7:34 pm

Post by ilovetoast »

Oh, forgot to mention I see no javscript errors that would stop this page from functioning in Safari. If you have it online somewhere I'll debug for Safari if you post a link.

peace
Post Reply