[Javascript] How to disable entire page when busy?
Alexander Yap
alex.yap at str.com.au
Sun May 19 22:53:43 CDT 2002
Hi all,
Does anyone know how to easily disable a page such that it doesn't accept
user input (and preferably also grey out the page if possible)?
I have a page with many controls, all submitting to Java servlets. Some of
the servlet processing can take a long time, and I do not want the user to
submit anything else while the servlet is busy. I thought of putting this
restriction on the server side, but that is not enough because my page also
has lots of Javascript objects that maintain states on client-side. If the
user clicks on something, and the server ignores the request, the Javascript
states will be out of synch with server-side session state.
Currently, I'm blocking user interaction by making visible a huge blank <div>
block that covers the whole page when busy. The problem is that my users
think that this suddenly appearing blank <div> is UGLY, because they're used
to desktop apps that nicely grey-out the controls when disabled.
Individually controlling the controls' event handlers (using a global flag)
is not practical because they are lots of them (some forms, some <div>s with
onclick function, and there are also a few subframes). What I need is to be
able to enable/disable user input at the window, document or body level.
I need to support IE5+ and Netscape 6.2, so I can't rely on Netscape's
captureEvents() either.
Any ideas??? Hope someone can help me here. I'm stuck.
Thanks in advance.
--
Alexander Yap
Melbourne, Australia
More information about the Javascript
mailing list