?
Solved

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

Posted on 2011-02-27
14
Medium Priority
?
398 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
Independent Software Vendors: 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 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Check out the latest tech news, community articles, and expert highlights in August's newsletter.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

800 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