Solved

how i can bring opened popup to front when multiple popups opened?

Posted on 2011-02-27
14
391 Views
Last Modified: 2012-05-11
Hi expert,
Please help me.
I have two jsp's  one.jsp , two.jsp.

In one.jsp i have few commandHelp links say commandHelp1, commandHelp2....

when i click commandHelp1 from one.jsp , the control goes to two.jsp with some command parameters.

I am using window.open from one.jsp to two.jsp(in which .swf is embedded) which opens flex page in two.jsp

so now, when i click commandHelp2 from one.jsp ,the current window will disappear and opens in another window.

Could you please let me know how i can see two command windows at a time  and also when i click commandHelp1

Link, the opened commandHelp1 Link should come front.

I mean i want to see multiple windows(some kind of pop ups),and when i click particular opened command window

that should come front.


Right now , my code in one.jsp is
----------------------------------

var oneWin = '';
function open_window(urlString, winprops, winName) {
    if (!oneWin.closed && oneWin.location) {
        oneWin.location.href = urlString;
    } else {
       //oneWin=window.open(urlString,'IPAGDetail',winprops);
       oneWin=window.open(urlString,winName,winprops);
       if (!oneWin.opener){
           oneWin.opener = self;
       }
    }

    if (window.focus) {
        oneWin.focus();
    }
    return;
}

function command_help(id,name,type,c_type)
{
  var winprops = 'height=700,width=718,top=0,left=0,resizable=yes,scrollbars=yes,status=no';
  var urlString = "/flexappl/helpView/two.jsp?Id= " + id + "&Name=" + name + "&Type=" + type + "&cardT=" + c_type;
  open_window(urlString, winprops, 'helpView');
}

Open in new window

0
Comment
Question by:Alpita
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
14 Comments
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 34995210
use this function

function lookAtTheChild()
{
      try{newwindow.focus();}catch(e){};
}
document.onkeyup=lookAtTheChild;
document.onmousedown=lookAtTheChild;
document.onmousemove=lookAtTheChild;
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 34995257
or alone use this

inside the script

document.onkeyup=lookAtTheChild;
document.onmousedown=lookAtTheChild;
document.onmousemove=lookAtTheChild;
0
 

Author Comment

by:Alpita
ID: 35000548
Hi Expert,
I added your code in  script block. But i do not see any change(not opening new window for commandHelp2 ). Could you please let me know where i am wrong?


I modified like this  in one.jsp:
----------------------------------

var oneWin = '';
function open_window(urlString, winprops, winName) {
    if (!oneWin.closed && oneWin.location) {
        oneWin.location.href = urlString;
    } else {
       oneWin=window.open(urlString,winName,winprops);
       if (!oneWin.opener){
           oneWin.opener = self;
       }
    }

    if (window.focus) {
       // oneWin.focus();
      document.onkeyup=lookAtTheChild;
      document.onmousedown=lookAtTheChild;
      document.onmousemove=lookAtTheChild; 
    }
    return;
}

function lookAtTheChild()
{
      try{newwindow.focus();}catch(e){};
}

function command_help(id,name,type,c_type)
{
  var winprops = 'height=700,width=718,top=0,left=0,resizable=yes,scrollbars=yes,status=no';
  var urlString = "/flexappl/helpView/two.jsp?Id= " + id + "&Name=" + name + "&Type=" + type + "&cardT=" + c_type;
  open_window(urlString, winprops, 'helpView');
}

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Alpita
ID: 35003722
Hi Expert,

I think i might have confused you.
The issue is , it is opening in same window. The requirement is to open in multiple windows instead of one.

Regards,
Alpita


0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35004212
I thought u want foucs only ur child window ! not the parent window !!  

the above code help you is

its foucus only popup window you cant go to parent with out closing that !!  so it may be useful to slove ur issue !!
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35004227
 
I modified like this  in one.jsp:  
----------------------------------  
  
var oneWin = '';  
function open_window(urlString, winprops, winName) {  
    if (!oneWin.closed && oneWin.location) {  
        oneWin.location.href = urlString;  
    } else {  
       oneWin=window.open(urlString,winName,winprops);  
       if (!oneWin.opener){  
           oneWin.opener = self;  
       }  
    }  
  
    if (window.focus) {  
       // oneWin.focus();  
         
    }  
    return;  
}  
  
function lookAtTheChild()  
{  
      try{newwindow.focus();}catch(e){};  
}  
document.onkeyup=lookAtTheChild;  
      document.onmousedown=lookAtTheChild;  
      document.onmousemove=lookAtTheChild;
  
function command_help(id,name,type,c_type)  
{  
  var winprops = 'height=700,width=718,top=0,left=0,resizable=yes,scrollbars=yes,status=no';  
  var urlString = "/flexappl/helpView/two.jsp?Id= " + id + "&Name=" + name + "&Type=" + type + "&cardT=" + c_type;  
  open_window(urlString, winprops, 'helpView');  
}

Open in new window

0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35004244
Or the simple way is jsut fous in the popup window !!

put  this inside the else condition

   if (window.focus) {    
        oneWin.focus();    
           
    }

 
var oneWin = '';    
function open_window(urlString, winprops, winName) {    
    if (!oneWin.closed && oneWin.location) {    
        oneWin.location.href = urlString;    
    } else {    
       oneWin=window.open(urlString,winName,winprops);  
       if (window.focus) {    
              oneWin.focus();    
         }    
  
       if (!oneWin.opener){    
           oneWin.opener = self;    
       }    
    }    
    
        return;    
}

Open in new window

0
 

Author Comment

by:Alpita
ID: 35006935
Hi expert,

It is still opening (refreshing) in same window.

Regards,
Alpita
0
 

Author Comment

by:Alpita
ID: 35028833
I got some information like if we give winname attribute ' ' in window.open(), then opens in multiple windows.

I tried , but not solved my problem.
Any ideas?

Regards,
Alpita
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35029329
you need that only right ! you need not open multiple window(popup) !

if you press another popup means it will open a in same winodw ! thats  all . what you experted other than this ?
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35029345
call this method in your html body onblur method lookAtTheChild()
0
 

Author Comment

by:Alpita
ID: 35162423
Is there any sample code example?
0
 
LVL 20

Accepted Solution

by:
Sathish David  Kumar N earned 500 total points
ID: 35162904
Try this
var oneWin = '';      
function open_window(urlString, winprops, winName) {      
    if (!oneWin.closed && oneWin.location) {      
        oneWin.location.href = urlString;      
    } else {      
       oneWin=window.open(urlString,winName,winprops);    
       if (window.focus) {      
              oneWin.focus();      
         }      
    
        
    }      
      
        return;      
} 


function lookAtTheChild()    
{    
      try{newwindow.focus();}catch(e){};    
}    
document.onkeyup=lookAtTheChild;    
      document.onmousedown=lookAtTheChild;    
      document.onmousemove=lookAtTheChild

Open in new window

0
 

Author Closing Comment

by:Alpita
ID: 35338208
Thanks a alot
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Reading data  from excel sheet and displaying 1 97
Java Exception example issues 11 84
maven webservice example issue 2 166
main method of string class 3 123
Invest in your employees with these five simple steps to improve employee engagement and retention.
Unified and professional email signatures help maintain a consistent company brand image to the outside world. This article shows how to create an email signature in Exchange Server 2010 using a transport rule and how to overcome native limitations …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question