Keeping pop-up on top of parent window

J

John Kotuby

Hello all,
I am new to Javascript and have been trying to find an answer to this
problem. After searching 3 books and searching postings, I am going to ask
this newgroup.

I am using a pre-built javascript DatePicker. It uses window.open to display
the Calendar and works fine if the user clicks on a link for a specific
date. The proper textbox in the parent window form is populated and the
DatePicker closes.

The problem is when a user clicks on the parent window, the datepicker is
hidden behind the parent window. Beleieve it or not, this creates a real
problem for many users.

Is there any way to put up an alert to the user and then set focus back to
the datepicker if the user clicks on the parent window by mistake?

In the datepicker.js there is a reference to the window created:

ggwindow = window.open(..parameters)

So I tried something like ggwindow.onblur=dont_close_me() referring to a
function that displays an Alert and then sets focus back to the datepicker
window. I know that onblur is an event and not a property or method of the
Window object, but I have also seen mentioned that the onblur event can be
applied to the Window object.

During window creation I don't see a way to set the onblur event for the
created window.

This is probably an easy question for an experienced javascript programmer,
so I am asking.

Thanks for your replies...
 
S

Steve

Hello all,
I am new to Javascript and have been trying to find an answer to this
problem. After searching 3 books and searching postings, I am going to ask
this newgroup.

I am using a pre-built javascript DatePicker. It uses window.open to display
the Calendar and works fine if the user clicks on a link for a specific
date. The proper textbox in the parent window form is populated and the
DatePicker closes.

The problem is when a user clicks on the parent window, the datepicker is
hidden behind the parent window. Beleieve it or not, this creates a real
problem for many users.

Is there any way to put up an alert to the user and then set focus back to
the datepicker if the user clicks on the parent window by mistake?

In the datepicker.js there is a reference to the window created:

ggwindow = window.open(..parameters)

So I tried something like ggwindow.onblur=dont_close_me() referring to a
function that displays an Alert and then sets focus back to the datepicker
window. I know that onblur is an event and not a property or method of the
Window object, but I have also seen mentioned that the onblur event can be
applied to the Window object.

During window creation I don't see a way to set the onblur event for the
created window.

This is probably an easy question for an experienced javascript programmer,
so I am asking.

Thanks for your replies...

I found this in another post:
The only way I know to do that is to include
<BODY ONBLUR="top.focus();">
in the BODY tag of the pop-up window.
 
J

John Kotuby

Thanks for the help Steve...

Steve said:
I found this in another post:
The only way I know to do that is to include
<BODY ONBLUR="top.focus();">
in the BODY tag of the pop-up window.
 
J

John Kotuby

Thanks Gary,

Looks like a great product,

I was also considering using the ASP.NET 2.0 Calendar control with CSS
absolute positioning and invisibility along with asynchronous callback to
the Server, but that seemed like much more work just to get this one problem
fixed.

I will test out the DIV control....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top