PDA

View Full Version : Open image w/ different bgcolor in same window?


pixel8or
01-30-2003, 10:08 PM
Hi all,
I'm trying to make a simple way to use a thumbnail image map to view any number of images without having to open a new window (no popups). I'd like to be able to center the image, change the background color and use the browser back button to return to the thumbnails. I haven't used a great deal of javascript, but I came up with this:

Sample Page (http://www.geocities.com/rixter201/javathumb.htm)

This works perfect in IE and Opera 7. But Netscape/Mozilla chokes on it.
Navigator 4.51 - loads page and bgcolor but doesn't display image, back button returns to thumbnails.
Netscape 6.2 - opens image and new bgcolor but won't stop loading, back button skips thumbnails and goes to previous page.
Mozilla 1.2.1 - opens image and bgcolor, won't stop loading, back button returns to thumbs.

Is there another way I can do this that will be cross browser compatible? I've searched for a script for this kind of thing and ended up working this out on my own.

Any help would be greatly appreciated.

kdjoergensen
01-31-2003, 10:45 AM
Try


function showimage(img) {
var outStr = "<html><head><title></title></head><body bgcolor='#336699'><br><br><center><img border='1' src=" + img + "></center></body></html>";

document.open();
document.write(outStr);
document.close();

}

pixel8or
01-31-2003, 01:50 PM
kdjoergensen,
Thanks for the quick reply.

That works great... for everything but Navigator 6.2.

And it's strange. When I go to the Geocities site, NN 6.2 disables the 'Back' button. But I can click the 'Reload' button and it returns to the image map page. I put the page on my AT&T broadband space and it goes to the image ok without the nonstop loading, but when I click 'Back' it skips past the image map page and goes to the previous site it was at before.

Netscape 4.5 won't load the images from the Geocities site but works fine from the AT&T host.

How does Netscape manage to keep existing? At least Mozilla/Phoenix are an improvement. Although none of these allows the Geocities popup to be closed.

I guess I could add a 'Back' link to the 'var outStr' line to compensate for the NN 6.2 problem.

Again, thanks for the help!

pixel8or
02-09-2003, 02:27 AM
Hi again,

I noticed from the stats at the GeoCities page I linked to above that of the 86 hits, 61% were Netscape 5.0 and 24% were Netscape 4.71. Since I only posted that link here, I take it that Netscape is popular in this forum. I suppose my comment about Netscape didn't go over too well.

Be that as it may... Is it possible to modify the code that kdjoergensen posted so Netscape will see the image map page as the opening document and not skip back to the previous page it was at? I noticed that in Netscape, when the image page opens, the image map page does not appear in the "Back" button drop down list like it does in IE and Opera.

I tried using a "back" link in 'var outStr' and it works, but this returns to the top of the image map page. The image map page will have additional thumbs that need to be scrolled to. The "Back" button returns to the image map clicked on. Returning to the top of the page requires the user to scroll down again each time... which can be annoying.

The new file is here. (http://home.attbi.com/~moorerf/misc/javathumb.htm)

Just trying to be Netscape friendly, here, instead of giving up on that 4% of web surfers. Any help would be appreciated.