[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Javascript reopening popup

Posted on 2007-04-11
7
Medium Priority
?
366 Views
Last Modified: 2008-03-06
Hi everybody,

In one of my PHP page I open a popup (window.open(...)) whern the user cliks on a button.
I'd like to close this popup window when the focus is not on this window anymore, i.e when the user has clicked on another window, and thus the popup window is not anymore on top.
So that I could re-open the pop up as many times as the user clicks my button, avoiding him to look for the popup window in the taskbar.
Hope I've been clear...
Thanks for advance,
Vincent
0
Comment
Question by:vinceTrace
[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
  • 3
  • 2
7 Comments
 
LVL 4

Expert Comment

by:Cyber-Drugs
ID: 18890232
Why not make use of a floating <div> element, rather than a popup window. This way you can just set the div to hide (rather than physically close) and unhide as often as you like.

Alternatively, you could grab the innerHTML() of the popup window in question, store the content in a variable, and re-open the window when needed, and populate it with the content which is stored in a variable.


Hope this helped.
0
 

Author Comment

by:vinceTrace
ID: 18890268
Thanks for your help.
To be consistant with my other pages I would prefer the popup solution, even if zhis is probably a less elegant solution...
Could you tell me more about the second solution?
0
 
LVL 4

Accepted Solution

by:
Cyber-Drugs earned 300 total points
ID: 18890382
I'm not able to test anything at the moment, but try this....

When creating your popup initially, do something like this:


var oPopup = window.createPopup();

That way your popup has a name reference, after that, do this:


var contentPopup = Popup.document.body.innerHTML;


contentPopup now contains the source code for the popup, when you recreate the pop, do something like:


Popup.document.body.innerHTML = contentPopup;



That's just the pseudo code, try it out, and if you have problems I'll take a look when I get home this evening for you.
0
 

Author Comment

by:vinceTrace
ID: 18890615
Can I set images within the popup?
When I said I open a popup, I open in fact an HTML page, with image and database access. This is a "normal" page, but has a popup function,, (for example ask the user to conform or cancel an action...)
0
 
LVL 4

Expert Comment

by:Cyber-Drugs
ID: 18890882
As long as the popup contains HTML, it can be stored. If you give an example, I could help you out a bit better.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

650 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