PDA

View Full Version : Popup Window Problem



Strangeplant
02-23-2007, 05:46 PM
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/wc/Test/PopupTest.html

Besides all that, the script generated code, for example:
<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,re sizable=yes';
win=window.open(mypage,myname,settings);}
// -->
</script>needs to be changed slightly to this:
/****************************************************
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,re sizable=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.)

jscheuer1
02-23-2007, 06:02 PM
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.