Strangeplant
02-22-2007, 08:36 PM
1) Script Title: Popup Window Generator
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/popwin.htm
3) Describe problem: It has been brought to my attention that people are not comfortable with the way the popup windows work, and I need a 'nice' solution for two problems.
First problem: The web page has several popups. If the user minimizes the popup, the next time he clicks a link for another popup, the window stays behind the page, it is not refocused, but stays blurred.
The code is this:
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);} and a typical call is this:
<a href="someimagereference.jpg" onclick="NewWindow(this.href,'indexpopup','640','480','no','random');return false" onfocus="this.blur()"> typical image</a>
The second problem is more difficult to describe. If the user clicks on the image (+ sign in circle), the image gets larger, and the user will expand the window size for the native dimensions, but the image is pushed off to the left and top with black padding on the right and bottom; the complete image does not display. Clicking on the (- in a circle) leaves the image off center and back to the original size. If the user then clicks on the full screen box, the image is still pushed out of bounds, but is correct in a full screen window if the user does NOT use the (+ in a circle) before he expands the window.
Just haven't been able to control this irritable thing, and I've been using it for a long time without complaint until now - it's possible the it is a new browser thing.
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/popwin.htm
3) Describe problem: It has been brought to my attention that people are not comfortable with the way the popup windows work, and I need a 'nice' solution for two problems.
First problem: The web page has several popups. If the user minimizes the popup, the next time he clicks a link for another popup, the window stays behind the page, it is not refocused, but stays blurred.
The code is this:
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);} and a typical call is this:
<a href="someimagereference.jpg" onclick="NewWindow(this.href,'indexpopup','640','480','no','random');return false" onfocus="this.blur()"> typical image</a>
The second problem is more difficult to describe. If the user clicks on the image (+ sign in circle), the image gets larger, and the user will expand the window size for the native dimensions, but the image is pushed off to the left and top with black padding on the right and bottom; the complete image does not display. Clicking on the (- in a circle) leaves the image off center and back to the original size. If the user then clicks on the full screen box, the image is still pushed out of bounds, but is correct in a full screen window if the user does NOT use the (+ in a circle) before he expands the window.
Just haven't been able to control this irritable thing, and I've been using it for a long time without complaint until now - it's possible the it is a new browser thing.