Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-06-2006, 06:40 AM   PM User | #1
ryebag
New to the CF scene

 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ryebag is an unknown quantity at this point
simple thumbnail viewer not working?

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: http://www.sculpture-in-metal.com/ca...re/family.html

Here are the first lines:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/pictpagetemplate.dwt" codeOutsideHTMLIsLocked="false" -->
<head>

<SCRIPT LANGUAGE="JavaScript">
<!-- 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) {
win.close();
setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);
return;
}
win.document.open();
win.document.write("<html><head><title>"+ititle+"</title>");
win.document.write("</head><body>");
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>");
win.document.close();
}
// End -->
</script>

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>

Last edited by ryebag; 08-06-2006 at 09:22 PM..
ryebag is offline   Reply With Quote
Old 08-06-2006, 07:07 AM   PM User | #2
RexxCrow
Regular Coder

 
RexxCrow's Avatar
 
Join Date: Jul 2006
Location: California
Posts: 275
Thanks: 6
Thanked 2 Times in 2 Posts
RexxCrow has a little shameless behaviour in the past
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) {
win.close();
setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);
return;



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')">
RexxCrow is offline   Reply With Quote
Old 08-06-2006, 06:38 PM   PM User | #3
ryebag
New to the CF scene

 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ryebag is an unknown quantity at this point
You said swap a self.close(); around it. How do I do that?
ryebag is offline   Reply With Quote
Old 08-07-2006, 12:42 AM   PM User | #4
RexxCrow
Regular Coder

 
RexxCrow's Avatar
 
Join Date: Jul 2006
Location: California
Posts: 275
Thanks: 6
Thanked 2 Times in 2 Posts
RexxCrow has a little shameless behaviour in the past
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!

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.
RexxCrow is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:37 AM.


Advertisement
Log in to turn off these ads.