Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    generic way to disable all events on a page

    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

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    How about blurring the page if it has focus?
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    New Coder
    Join Date
    Aug 2002
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't get it. Can you please give me an example ?

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

  • #4
    New Coder
    Join Date
    Sep 2003
    Location
    sunny england
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    New Coder
    Join Date
    Aug 2002
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 ?

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    Atlanta, GA.
    Posts
    313
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <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.

  • #7
    New Coder
    Join Date
    Aug 2002
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #8
    wac
    wac is offline
    Regular Coder wac's Avatar
    Join Date
    Sep 2002
    Location
    Cary, North Carolina, USA
    Posts
    359
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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?
    Wayne Christian

  • #9
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    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 that brothercake discovered.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •