Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need an always-on-top pop-up help window that doesn't stop input in main window

0 views
Skip to first unread message

John Ramsden

unread,
Jan 30, 2003, 12:25:54 PM1/30/03
to
I need to code a pop-up help window that stays on top for the user to
view as they type in a textarea on the main window.

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 M. Ferris

unread,
Jan 30, 2003, 12:45:00 PM1/30/03
to
You could always try displaying a previously hidden DIV in place of a
pop-up. It seems that you would be able to mimic what you are trying to
do without having to actually ever open another browser window.

--Joseph

DU

unread,
Jan 30, 2003, 2:22:32 PM1/30/03
to
John Ramsden wrote:
> I need to code a pop-up help window that stays on top for the user to
> view as they type in a textarea on the main window.
>
> 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!
>

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

0 new messages