I copied the code from the following page, which certainly produces
an always-on-top pop-up (AOTPO) window:
http://www.webreference.com/javascript/960826/windows.html
But the trouble is, once the pop-up is open, one can no longer type
any input in the form on the main window!
It seems like the trouble is caused by the pop-up constantly keeping
the focus on itself. So I hope that 'being on top' and 'having focus'
are not one and the same thing!
In case anyone is reading this with a text-only newsreader, so they
can't click on the link, or they might want to annotate the relevant
code in a reply, here is a summary of HTML/javaScript code for an
AOTPO window, according to the page whose URL I gave:
The pop-up window link, with sample values, in the main window:
<a onclick="window.open('popup.htm',
'sub',
'toolbar=no,
directories=no,
location=no,
status=no,
menubar=no,
resizable=no,
scrollbars=no,
HEIGHT=490,
WIDTH=490,
left=80,
top=50');
return false"
href='popup.htm'>Click here for Help</a>
In the <head> section of the pop-up window:
<script language="JavaScript">
var OnTop = true;
function ChangeOnTop()
{
if (OnTop)
OnTop = false;
else if (!OnTop) <-- 'else' should do, but that was on the page!
{
OnTop = true;
self.focus();
}
}
function FocusMe()
{
if (OnTop) setTimeout("self.focus()",250);
}
</script>
Inside the <body> tag of the pop-up window:
onBlur = "FocusMe()";
Any ideas?
Cheers
John Ramsden (john_r...@sagitta-ps.com)
--Joseph
You cannot have both when resorting to focus() calls.
> It seems like the trouble is caused by the pop-up constantly keeping
> the focus on itself. So I hope that 'being on top' and 'having focus'
> are not one and the same thing!
>
You would need to use z-lock feature which implies increased security
privileges.
Yeah... just else would have sufficed. It maybe an subconscious writing
style... this way, you're a lot more sure to never create a logical bug.
> {
> OnTop = true;
> self.focus();
> }
> }
>
> function FocusMe()
> {
> if (OnTop) setTimeout("self.focus()",250);
That's the problem. Focus granted to a popup will remove focus in
another window: you can't have both.
> }
>
> </script>
>
>
> Inside the <body> tag of the pop-up window:
>
> onBlur = "FocusMe()";
>
>
> Any ideas?
>
>
> Cheers
>
> John Ramsden (john_r...@sagitta-ps.com)
I suggest you examine again your whole page design and ask yourself why
you absolutely need to have a popup visible hovering above a page like
that. I know a way to achieve what you want but I would need to see your
page, your whole page first.
Keeping things as simple as possible for the users, not relying too much
on javascript is often the best solution. Often, not using javascript or
any scripting language is the best, most successful way to do things.
DU