Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New window to stay on top of parent 1

Status
Not open for further replies.

vpekulas

Programmer
Jan 8, 2002
154
CA
Hello all,

Just wandering if it is possible to force a new pop-up window to always stay on top of the parent. I don't need to
set focus on it, just to sty on top. So you'd be able to wok on parent window and yet still see the pop-up window.

"Taxes are the fees we pay for civilized society" G.W.
 
vpekulas,

This works in IE, but doesn't seem to work all of the time in NN...

Hope it helps!

Dan

Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
	function openWin()
	{
		childWinObj = window.open('about:blank', 'childWin', '');
	}
//-->
</SCRIPT>
</HEAD>
<BODY onBlur=&quot;window.focus();&quot;>
Click <A HREF=&quot;javascript:openWin();&quot;>here</A> to open window.
</BODY>
</HTML>
 
I don't think it is possible to have window A stay in front of window B while you continue to work on window B. Once a window gets focus, it displays the whole window.

Now, if you want the window to stay above the other window, then that is a coordinate issue. You can move and/or resize the current window and place the popup above it so that you see both at the same time, but as far as having a window on top of the window in focus, I don't think that is possible.

You can, however, fake it and do something like when you go to the tek-tips homepage for the first time and another 'window' drops down. You can set the coordinates to whatever you want. Then you can do some fancy javascript to move it with the mouse. But that is somewhat intense.
 
Hehe...

I just realised tat my code does things the wrong way round.. it keeps the parent on top ;o)...

These twho files will do what you're after, keeping the child window on top:

Code:
parent.html
-----------
<HTML>
<HEAD>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
	function openWin()
	{
		childWinObj = window.open('child.html', 'childWin', '');
	}
//-->
</SCRIPT>
</HEAD>
<BODY>
Click <A HREF=&quot;javascript:openWin();&quot;>here</A> to open window.
</BODY>
</HTML>

child.html
----------
<HTML>
<HEAD></HEAD>
<BODY onBlur=&quot;window.focus();&quot;>
Child window...
</BODY>
</HTML>

Hope this helps!

Dan
 
True, the code BillyRayPreachersSon wrote does make the child window always onFocus, but vpekulas wanted to be able to work on the parent window while the child window was on top. I don't see how that is possible. With the code above, it is extremely frustrating, because you won't be able to do anything, including switching applications, until you close that window. I don't see any practicality in that.
 
Well, it seems that there is no solution :)
Thanks for the confirmation guys.


&quot;Taxes are the fees we pay for civilized society&quot; G.W.
 
Thanks adam0101, that was exactly what I needed !

&quot;Taxes are the fees we pay for civilized society&quot; G.W.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top