I want a popup window onclick which close itself when next page is displayed

K

KS

Is it possible to write a javascript that makes a popup window when someone
click on buttons/href on my page and close itself when the new page is about
to get loaded? I want to prevent the user from clicking anything else on my
page while the request is getting a new page. The popup window must lock the
focus.
I use frames i can not just disable all the buttons an href in different
frames.
 
L

lallous

Hello

you can get the window object as var newwin = window.open() ; later as the
page unloads you can call newwin.close();
to catch the document unload event capture the window.unload event.
 
K

KS

Thanx thats what i was looking for and i did something like this.

<//html file A
<SCRIPT>

// Vedlikehold av regningsadresse
function ventvindu() {
open("/PlexSysWeb/marked/venting.jsp", "jada123", "width=x,height=y");


}

</SCRIPT>


//html file B that close what A as opened
<SCRIPT>

var w = open("#", "jada123");
w.close();


</SCRIPT>

There is only one problem to this. Nothing prevents the user from clicking
on the html page A and ignore the popup window to hold youre horses until
the prosess is done. I NEED to prevent any clicking whatsoever while
somepage is prosessing. Making it bulletproof even for the most stupid user
!
 
L

lallous

Hi

One suggestion is to make the popup window big enough to cover its parent.
I am not sure if Onblur event will work with window object, if so, you can
capture OnBlur and then setfocus() again.
 
K

KS

The onblure was not a bad idee ill try it.
Have the popup cover the hole page seems a bit extreme since this is a
serious web application.
I tried jusing showModalDialog window for IE and works the way that i want.
It locks all the foucus into the window, the only problem it also stops all
the posting from the parent page until showM.. window is closed. The idea is
that the next page should close it not the user.
If i somehow could use showModalDialog, but make the parent page got to next
page, and make that next page close showModalDialog. This actually works
with window.open but then the focus will not be locked the way i want.

Another solution is to capture all click event from the usermouse and
somehow supress it after someone have clicked a button on the page. Not sure
how to this.

Since the web application a combination of frames and include i need a
general way to prevent user actions after a button are clicked. Disable all
buttons on a singel page which not use of frames is solved by using
document.getElementsByTagName
and loop trhough the hole document and disable whatever i want.

Thanx for the idea
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top