Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Disabling the shortcuts such as Ctrl+A, Ctrl+B.... using Javascript

Reply
Thread Tools

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

 
 
Gouri.Mahajan7@gmail.com
Guest
Posts: n/a
 
      07-10-2008
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.
 
Reply With Quote
 
 
 
 
Joe Fawcett
Guest
Posts: n/a
 
      07-10-2008


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
Munna
Guest
Posts: n/a
 
      07-10-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shortcuts and non-shortcuts. Patrick D. Rockwell Computer Support 14 07-04-2004 04:49 PM
Keyboard using shortcuts, never asked it 2.. fredcromer Computer Support 1 05-16-2004 03:33 PM
Problems with disabling ASP.NET controls using javascript john ASP .Net 1 04-20-2004 08:29 PM
Disabling LinkButton using JavaScript? Jeelz ASP .Net 2 06-28-2003 08:13 PM



Advertisments