Disabling the shortcuts such as Ctrl+A, Ctrl+B.... using Javascript

Discussion in 'ASP .Net' started by Gouri.Mahajan7@gmail.com, Jul 10, 2008.

  1. Guest

    Hello,

    Can anybody please tell me how to disable the shortcuts of the
    internet explorer? I have hosted control on the web page and i want to
    give the inputs such as Ctrl+A, Ctrl+B and so on.. but whenever I type
    them pop up windows open in internet explorer. How to disable them??


    Thanks.

    Regards,
    Gouri.
     
    , Jul 10, 2008
    #1
    1. Advertising

  2. Joe Fawcett Guest

    <> wrote in message
    news:...
    > Hello,
    >
    > Can anybody please tell me how to disable the shortcuts of the
    > internet explorer? I have hosted control on the web page and i want to
    > give the inputs such as Ctrl+A, Ctrl+B and so on.. but whenever I type
    > them pop up windows open in internet explorer. How to disable them??
    >
    >
    > Thanks.
    >
    > Regards,
    > Gouri.

    Not sure this is ASP.NET but you look at handling the keydown and keypress
    events. However not all key combinations can be cancelled and it's generally
    poor UI practice to try to override standard combinations such as Ctrl+A
    which the user might expect to select all text in a textarea, for example.

    http://www.w3schools.com/jsref/jsref_onkeypress.asp


    --

    Joe Fawcett (MVP - XML)
    http://joe.fawcett.name
     
    Joe Fawcett, Jul 10, 2008
    #2
    1. Advertising

  3. Munna Guest

    Re: Disabling the shortcuts such as Ctrl+A, Ctrl+B.... usingJavascript

    HI

    I have tried this code but didn't work...
    <script type="text/javascript">
    document.onkeydown = function somefunction(e)
    {
    e = window.event;
    //17 is keycode for "A"
    if(e.ctrlKey == true && e.keyCode == parseInt("17") )
    {
    e.cancelBubble = true;
    return false;
    }
    }
    </script>

    it detect the keys but the browsers still select the texts

    Best of luck

    ------
    Munna

    www.munna.shatkotha.com/blog
    www.munna.shatkotha.com
    www.shatkotha.com
     
    Munna, Jul 10, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ekta

    keyboard shortcuts in asp.net

    ekta, Jun 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,208
  2. Danny

    Implement Ctrl-C, Ctrl-V

    Danny, Aug 14, 2003, in forum: C++
    Replies:
    5
    Views:
    666
    CBFalconer
    Aug 15, 2003
  3. Danny

    Implement Ctrl-C, Ctrl-V

    Danny, Aug 14, 2003, in forum: C Programming
    Replies:
    5
    Views:
    684
    CBFalconer
    Aug 15, 2003
  4. Angus
    Replies:
    5
    Views:
    2,207
    Michael Rauscher
    Nov 18, 2006
  5. Replies:
    0
    Views:
    579
Loading...

Share This Page