Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Regular Coder RexxCrow's Avatar
    Join Date
    Jul 2006
    Location
    California
    Posts
    275
    Thanks
    6
    Thanked 2 Times in 2 Posts
    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')">

  • #3
    New to the CF scene
    Join Date
    Aug 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You said swap a self.close(); around it. How do I do that?

  • #4
    Regular Coder RexxCrow's Avatar
    Join Date
    Jul 2006
    Location
    California
    Posts
    275
    Thanks
    6
    Thanked 2 Times in 2 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •