"Help" child window on top

I am having problems trying to get a child window to come up "on top", and come up again on top when reinvoked.

On each of my pages, I have a link to create a Help child window:

<script language="JavaScript">
var newWin
function openHelp() {
newWin=window.open("context.htm","help","width=200 height=200");

where "context.htm" represents the context-sensitive help page corresponding to the help needed for the current page.

However, once the user has brought up this help child-window (the first time, it will appear on top), if she mistakenly clicks on the main window instead of closing the help window, then she will push the child help window back.  Thereafter, whenever she clicks on a help link in a main window, the appropriate help text will flow into the help child window, but the help window will remain BEHIND the main window, and the naive user will think that the help links are no longer functional.

Is it possible to bring a child window to the fore (on top).  Or possible, perhaps, to close a child help window (from any page) and then bring it up anew, so that it comes up on top?
Who is Participating?
Michel PlungjanConnect With a Mentor IT ExpertCommented:
Joseph, you mistake it for onBlur=focus

The code Kurt posted is fine for focussing when the page is loaded and only then. I prefer this amendment to stop IE3 from complaining:

<body onLoad="if (window.focus) self.focus()">

In your context.htm file(s), put the following in your body tag:

<body onLoad="window.focus()">

Well, the solution Kurt gave keeps a window on top, and this might be what you want, but the irritating part about this is that first now this window must be closed and no interaction can take place between other windows.
I had the same problem you have, pbrooks, for a client, but I solved it after a while. To see an example work, check out http://joseph.auvicom.nl and click on the appropriate link. Then you can view the source and see how it's done. Note that AND the child windows opened AND the parent window both have code necessary to let this work. I will give hints in the code ok?

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

OH, yeah, Kurt, forgive me please ;) Thx Michel. But this way it keeps opening a new window, doesn't it?

Michel PlungjanIT ExpertCommented:
No. The window named help will be reused.

pbrooksAuthor Commented:
Thank you, Michel.  That does the trick.

Joseph: the problem with your solution is that I think it requires a javascript variable (NewWin?) to be shared amongst all of the web pages that call help pages, in order to close the background help page.  If the child help page remains up, but I go to another main page, and click on help there, the child page's window variable is no longer accessible in the new page, and therefore the child window cannot be closed.
Yes, I understand, what Michel proposed here seems for this the best solution. And I also learned a thing with this. Thanks Michel!

Joseph ;)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.