posted 10 years ago
Hi All,
I have a requirement to open two popup windows from two different links and show side by side. On clicking first link first popup opens. When I click second link (on parent window), the first popup is going behind the parent window and the second popup is opening. Now the order I can see is second popup(front), parent window (middle) and first popup (behind parent window).
How can I call the first popup front on opening of second popup ? I am using google chrome.
I am using the following code to do this task, not sure where the code is going wrong...
var popup1;
var popup2;
function openPopUpWin(type){
if(type=='true'){
var url="http://"+port+"/login.html?LoginID="+loginId";
var h=850; var w = 800;
x = (w)/2, y = (h)/2;
if (screen) {
y = (screen.availHeight - h) / 2;
x = (screen.availWidth - w) / 2;
}
popup1 = window.open(url, 'popup1','scrollbars=yes, width='+w+ ',height='+h+',screenX='+x+',screenY='+y+',top='+0+',left='+0);
popup1.focus();
}else{
var url="loginservler!loginaction?loginId="+loginId;
var height =800;var width = 970;
x = (w)/2, y = (h)/2;
if (screen) {
y = (screen.availHeight - h) / 2;
x = (screen.availWidth - w) / 2;
}
popup2 = window.open(url, 'popup2','scrollbars=yes, width='+w+ ',height='+h+ ',screenX='+x+ ',screenY='+y+ ',top='+0+ ',left=' +$(window).w)/2);
popup1= window.open("",popup1);
if(popup1){
popup1.focus();
}
}
}
Any help appreciated..
Thank you