Can a page be disabled from JavaScript?

T

Tom Szabo

Hi All,

I know that one can disable the page by putting "disabled" into the
<body....> tag, but can this be done from a java script.


What I want to achieve is: once the user brings up a "child" window, the
child disables the parent until the user finished and closes the child, then
the parent is enabled again...

TIA,

Tom
 
R

RobG

Tom said:
Hi All,

I know that one can disable the page by putting "disabled" into the
<body....> tag, but can this be done from a java script.

Works for IE, but not for Firefox and I suspect not for any similar
browser. I didn't test setting it using JavaScript.
What I want to achieve is: once the user brings up a "child" window, the
child disables the parent until the user finished and closes the child, then
the parent is enabled again...

Effectively you want a modal dialog. You have to be careful with the
user interface - how will you determine when the user "finishes" with
the child? What if they just close the child? What if the child is
closed before it finishes opening, so any onunload you may have to
re-enable the parent have doesn't get activated? Does the parent stay
disabled?

If the parent page really does depend on the outcome of the child page
then it is likely much better to use traditional navigation.

Cheers, Rob.
 
T

Tom Szabo

Thanks Rob,

I understand the implication of this game, but I am implementing a lookup
form and this is the way it has to work.

The application mainly for internal use, so I don't really care if not 100%
compliant

Thanks,

Tom
 
T

Tom Szabo

RobG said:
Tom said:
Thanks Rob,

I understand the implication of this game, but I am implementing a lookup
form and this is the way it has to work.

The application mainly for internal use, so I don't really care if not 100%
compliant

I had a play with:

var b = document.getElementsByTagName('body');
b[0].setAttribute('disabled','true');

which would seem the correct way to do it according to Microsoft's
documentation, however it only partially works - buttons etc. are
greyed out and don't work the first time, however clicking them a
couple of times brings them back to life. Even using <body disabled>
does not fully disable buttons, you can't put content into fields but
the buttons still work (scripts still run, submit still submits,
reset resets, etc.).

Note that none of the above had any effect on non-IE browsers.

So I would guess you are out of luck, unless you want to go through all
the controls on the page and disable them manually using JavaScript...

Cheers, Rob.

Actually the one-by-one is not a bad suggestion...:)

I dont mind programming, have been doing it for many years....but I need to
get this ..

and thanks for the above,

Regards,

Tom
 
R

RobG

Tom said:
Thanks Rob,

I understand the implication of this game, but I am implementing a lookup
form and this is the way it has to work.

The application mainly for internal use, so I don't really care if not 100%
compliant

I had a play with:

var b = document.getElementsByTagName('body');
b[0].setAttribute('disabled','true');

which would seem the correct way to do it according to Microsoft's
documentation, however it only partially works - buttons etc. are
greyed out and don't work the first time, however clicking them a
couple of times brings them back to life. Even using <body disabled>
does not fully disable buttons, you can't put content into fields but
the buttons still work (scripts still run, submit still submits,
reset resets, etc.).

Note that none of the above had any effect on non-IE browsers.

So I would guess you are out of luck, unless you want to go through all
the controls on the page and disable them manually using JavaScript...

Cheers, Rob.
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top