Results 1 to 2 of 2

Thread: Popup Window Problem

  1. #1
    Join Date
    Feb 2006
    Posts
    236
    Thanks
    8
    Thanked 3 Times in 3 Posts

    Default Popup Window Problem

    1) Script Title: Popup Window Generator

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/popwin.htm

    3) Describe problem: The window pops up OK the first time. But, when you mouseover and the (+) comes up, and you click, the image enlarges. The image is now too large for the frame, so you resize it, and then it starts acting strangely and subsequent (+) or (-) clicks and reposition it within the popup window, never really getting control of it again to view it correctly. Much of the time there is black space around the botton and/or the right side, and if you click in this area, the image goes greyish.

    A working test example of the problem can be seen at: http://earth.engr.ccny.cuny.edu/noaa...PopupTest.html

    Besides all that, the script generated code, for example:
    Code:
    <script language="javascript" type="text/javascript">
    <!--
    /****************************************************
         Author: Eric King
         Url: http://redrival.com/eak/index.shtml
         This script is free to use as long as this info is left in
         Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
    ****************************************************/
    var win=null;
    function NewWindow(mypage,myname,w,h,scroll,pos){
    if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
    if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
    else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
    settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
    win=window.open(mypage,myname,settings);}
    // -->
    </script>
    needs to be changed slightly to this:
    Code:
    /****************************************************
         Author: Eric King
         Url: http://redrival.com/eak/index.shtml
         This script is free to use as long as this info is left in
         Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
    ****************************************************/
    var win=null;
    function NewWindow(mypage,myname,w,h,scroll,pos){
    	var TopPosition
    	var LeftPosition
    	var settings
    if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
    if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
    else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
    settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
    win=window.open(mypage,myname,settings); win.focus();}
    Because without that, if the popup is minimized and not closed, subsequent calls leave the popup invisible behind the current browser window. (Thanks to jscheuer for this correction in today's forum.)
    Last edited by Strangeplant; 02-23-2007 at 06:51 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That is not so much a bug as the way that pop up windows work. The bit about focus isn't needed so much if you give each window its own name. That will also take care of the size of the window. But, it will pop up more windows, not reuse the existing one unless it has the same name. Or, the open window (if any) can be closed before the next one is popped up. This can take care of a lot too. Various other things can be worked out as needed as well. The script itself is fine for what it does.

    If you want to pursue any of these remedies, please do so in the main help section.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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