View Full Version : simple thumbnail viewer not working?

08-06-2006, 07:40 AM
I have a simple thumbnail viewer script on the following page. The thumb opens on my computer but not on the other two computers I've tried with pop-up blocking off, it flashes and then says about: blank. the thumb should open in larger window titled sculpture viewer. Okay so I'm assuming that was happening on xp now I'm on a fourth computer, ie6, and downloaded the latest version of java (I don't know if that matters) now sometimes the sculpture images open like theyre supposed to, other times it opens about:blank. and I get the following error message : (also if I refresh the page the thumb will work once)

Line: 23
Char: 1
Error: Object Required
Code: 0
URL: www.sculpture-in-metal.com/cast-bronze-sculpture/family.html

Here are the first lines:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<html><!-- InstanceBegin template="/Templates/pictpagetemplate.dwt" codeOutsideHTMLIsLocked="false" -->

<!-- Original: Anders Jennerberg (anders@katedral.se) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function ViewImage(ifile,ix,iy,ititle) {
var win;
var sWidth;
var sHeight;
var NS = (document.layers) ? 1 : 0;
win = window.open("","imageviewer","width="+ix+",height="+iy+",menubar=no,toolbar=no");
if (NS) {
sWidth = win.innerWidth;
sHeight = win.innerHeight;
} else {
sWidth = win.document.body.clientWidth;
sHeight = win.document.body.clientHeight;
if(sWidth!=ix || sHeight!=iy) {
setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);
win.document.write('<div style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
win.document.write("<img src="+ifile+"></div></body></html>");
// End -->

and then thumbnails are as follows on a single line:

<td width="138" height="55"><div align="left"><a href="javascript:ViewImage('../images/sculpture-original/096.jpg',400,599,'Sculpture Viewer')"><img src="../images/sculpture-thumbs-compressed/096_Cast_Bronze_Sculpture_Metal_Family_Thumb.jpg" width=65 height=97 border=1></a> </div></td>

08-06-2006, 08:07 AM
It works fine in FF but suddenly closes in IE, I had that problem before until I swapped a self.close(); around then it started working correctly... the only thing I was wondering about was this:

if(sWidth!=ix || sHeight!=iy) {
setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);

Though it might be similar to the same problem I was just having, you could try changing that inline href javascript to:

href=""onclick="ViewImage('../images/sculpture-original/115.jpg',400,615,'Sculpture Viewer')">

08-06-2006, 07:38 PM
You said swap a self.close(); around it. How do I do that?

08-07-2006, 01:42 AM
The problem I had was in my function that I setup was that it was closing itself out before it did anything else, I first thought it would keep doing the things in the function regardless, but I found out that as soon as the window closes itself it does not continue, as it can't anymore, I was thinking the function preloaded and kept working, though seems to read as it goes. So I switched the close part to then end of the function and it works perfect now. Prob common sense I was just trying to think outside the box and experiment, as I am learning all this mumbo jumbo still! :cool:

I was hopping that onclick would fix ur prob. I went back and looked at it again and think this might be causing an issue, and also explains why it works fine in FF but not IE, now I am not sure if this is it or not but seems likely as a cause, in ur A tags for the image view you included qoutes in a few of the items and in the function for it, it appears to also be including qoutes again, so that may be the cause as to why it acts fishy.

Also that timeout win close looks like it is just closing the function and then reopening it, if the screen or window is not right, not sure why it is doing that though, looks weird, but dont think that is the cause to any probs though.