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 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2010
    Posts
    24
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Question Pop Up Window Won't Finish Loading

    Hi all, I've been trying to figure out for the past 4 hours why this JS pop up window function I wrote won't finish loading in Firefox. When you click the thumbnail image, it pops up a new window with the image enlarged. But for some reason, the Firefox page loading bar on the bottom right-hand side stops at about 25%, even after the image finishes loading. What is wrong with my code that I need to fix so the page shows that it loaded 100%?

    Here is a link to the page:
    http://www.unitedautoandtruck.com/cu...ilt_truck.html

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    
    <script language="javascript" type="text/javascript">
    <!--
    function pop_up_window (image, title, width, height, text, close_button, scroll_bars, bg)
    {
       var l = (screen.width-width) / 2 - 6;
       var t = (screen.height-height) / 2 - 28;
       var pop_up = window.open('', '_blank', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scroll_bars+',resizable=no,copyhistory=no,top='+t+',left='+l+',width='+width+',height='+height);
    
       pop_up.document.write ('<html>');
       pop_up.document.write ('<title>'+title+'</title>');
       window.name='main';
       if (bg == 'default')
          bg = '#FFFFFF';
       if (bg.charAt(0) == '#')
          pop_up.document.write ('<body bgcolor='+bg+' text=black link=blue vlink=purple alink=red>');
       else
          pop_up.document.write ('<body background="'+bg+'" text=black link=blue vlink=purple alink=red>');
       pop_up.document.write ('<style> A:link {text-decoration: none} A:visited {text-decoration: none} A:active {text-decoration: none} </style>');
       if (image != ' ')
       {
          pop_up.document.write ('<center><img src="'+image+'"></center>');
       }
       if (text != ' ')
       {
          pop_up.document.write ('<center><table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="94%"><tr><td>');
          pop_up.document.write (''+text+'');
          pop_up.document.write ('</td></tr></table></center>');
       }
       if (close_button == 1)
       {
          pop_up.document.write ('<form name="closeit">');
          pop_up.document.write ('<center><input type="button" value="Close" onClick="window.close();"></center>');
          pop_up.document.write ('</form>');
       }
       pop_up.document.write ('</body>');
       pop_up.document.write ('</html>');
    }
    // -->
    </script>
    
    <title>Transformers Peterbilt Truck</title>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    </head>
    
    <body>
      <a href="javascript:pop_up_window ('../images/customgallery/transformers_peterbilt_truck/DSC02061.jpg', 'Transformers', 623, 534, ' ', 1, 'no', 'default')" onMouseOver="window.status='Press to Enlarge'; return true">
      <img src="../images/customgallery/transformers_peterbilt_truck/DSC02061.jpg" width="150" height="113"></a>
    </body>
    </html>
    Last edited by zaltek; 01-11-2011 at 05:56 AM.

  • #2
    Regular Coder oVTech's Avatar
    Join Date
    Nov 2010
    Location
    USA
    Posts
    296
    Thanks
    4
    Thanked 54 Times in 52 Posts
    HERE YOU ARE (see changes in red):

    Code:
    function pop_up_window (image, title, width, height, text, close_button, scroll_bars, bg)
    {
       var l = (screen.width-width) / 2 - 6;
       var t = (screen.height-height) / 2 - 28;
       var pop_up = window.open('', '_blank', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scroll_bars+',resizable=no,copyhistory=no,top='+t+',left='+l+',width='+width+',height='+height);
    	   pop_up.document.open();
       pop_up.document.write ('<html>');
       pop_up.document.write ('<title>'+title+'</title>');
       window.name='main';
       if (bg == 'default')
          bg = '#FFFFFF';
       if (bg.charAt(0) == '#')
          pop_up.document.write ('<body bgcolor='+bg+' text=black link=blue vlink=purple alink=red>');
       else
          pop_up.document.write ('<body background="'+bg+'" text=black link=blue vlink=purple alink=red>');
       pop_up.document.write ('<style> A:link {text-decoration: none} A:visited {text-decoration: none} A:active {text-decoration: none} </style>');
       if (image != ' ')
       {
          pop_up.document.write ('<center><img src="'+image+'"></center>');
       }
       if (text != ' ')
       {
          pop_up.document.write ('<center><table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="94%"><tr><td>');
          pop_up.document.write (''+text+'');
          pop_up.document.write ('</td></tr></table></center>');
       }
       if (close_button == 1)
       {
          pop_up.document.write ('<form name="closeit">');
          pop_up.document.write ('<center><input type="button" value="Close" onClick="window.close();"></center>');
          pop_up.document.write ('</form>');
       }
       pop_up.document.write ('</body>');
       pop_up.document.write ('</html>');
       pop_up.document.close();
    }

  • Users who have thanked oVTech for this post:

    zaltek (01-11-2011)

  • #3
    New Coder
    Join Date
    Dec 2010
    Posts
    24
    Thanks
    7
    Thanked 0 Times in 0 Posts
    You sir are a genius. Thank you so much.


  •  

    Posting Permissions

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