...

View Full Version : generic way to disable all events on a page



markivs
10-01-2003, 04:25 PM
Is there a generic way to disable all events on a page ?

Basically, I want my page to show up as read only. None of the links or buttons should be clickable. Form elements should be disabled too. The whole page should just look like a screen shot for the user.

I am concerned only about IE.

Please let me know if there is a solution.

Thanks.
Mark

liorean
10-01-2003, 04:26 PM
How about blurring the page if it has focus?

markivs
10-01-2003, 04:55 PM
I don't get it. Can you please give me an example ?

I tried window.blur on window onload. But didn't work.

billytalent
10-01-2003, 05:17 PM
to disable a form element you simply need to add "disabled" in the elements tag, I dont know if this works for links aswell, however, a disabled form element has a different appearance, so if you want the page too look completely normal but nothing be clicking, the disabled attribute wont be for you.

markivs
10-01-2003, 05:41 PM
yeah, I know making the form elements disabled will help, but that's not something I want to do. I looking for something more generic, rather than looping thro all form elements and disabling it.

May be something in javascript which will capture all the events on the page and supress them ?

RoyW
10-01-2003, 06:13 PM
<div style="position:absolute;left:0;top:0;width:100%;height:100%;background-color:red;filter:alpha(opacity=1);z-index:1000"></div>

You may have to specify a width,height in pixels if you page scrolls.

markivs
10-01-2003, 08:08 PM
That's a great solution. Thanks !
There's one problem though. If there is a SELECT list in your page, it will be on top of the div.
That's bcos, SELECT has a z-index of infinity. Anyway, I loop through all the SELECTS in the page and disable them.

wac
11-26-2003, 09:50 PM
I've noticed that on IE, although this solution doesn't allow you to click into a field, you can still TAB to a field and the field will accept keyboard input :( . I am using the same solution but have found this bit of 'feature' annoying. Other than looping through and removing onkey***, is there a better way to stop keyboard input?

glenngv
11-27-2003, 11:28 AM
There's one problem though. If there is a SELECT list in your page, it will be on top of the div.
That's bcos, SELECT has a z-index of infinity.


try:

<div style="position: absolute;left: 0px; top: 0px;width: 100%;height: 100%;background-color: red;filter: alpha(opacity=1);z-index: 1000">
<iframe style="position: absolute;left: 0px;top: 0px;width: 100%;height: 100%;z-index: 999" src="about:blank" frameBorder="0" scrolling="no"></iframe>
</div>


From the technique (http://www.codingforums.com/showthread.php?s=&threadid=28261) that brothercake discovered.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum