Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disable all keyboard events 1

Status
Not open for further replies.

xorbi

Programmer
Jul 4, 2002
2
FR
Hello,

I would like to disabel all keyboard events.
I'm working with win XP an Ie6.

I can disable nearly all events with this script :

document.onkeyup =function(){return false};
document.onkeypress=function(){return false};
document.onkeydown=function(){return false};

But events like F1, Ctrl-P, Ctrl-F or Ctrl-N still working.

I tried to disable some of this events by modifying IE properties but Ctrl-P & Ctrl-F still working.

Could sommeOne Help me.


 
yes I can help you. I can educate you on why this shouldn't be done and why it cannot.

How would you like it if all of a sudden somebody took over your computer? What if I put a thing full screen in front of you and disable everything like ALT-F4, ALT-TAB? What would you be able to do if I also disabled your hard drive?

Don't you thing that it would suck? Why do you think javascript doesn't allow you to erase everything on the hard drive or write files for that matter? Heck anyone could write a page that stall windows to a grind and makes it unbootable.

I hope this helps. Gary Haran
 
sorry,

I just want to disable default behavior of some shortcuts
to give them another one.
for example I want to focus somewhere in my page when the user press ctrl-p, but i dont want the print screnn to display.
 
If you want total control over the keyboard (or any other system resource) you're probably going to have to use an OS that delivers that kind of access or write your own. If you want to use Windows then you're going to have to deal with CTL-ALT-DEL. Following the same logic, IE is going to grab certain keys for its uses, F11 for example. By the time you get down to JavaScript running under IE6 running under XP you've lost a measurable bit of control (and gained a pretty decent programming environment).

Microsoft offers some technologies like HTAs that let you use IE as a user interface for applications. This may be what you're looking for.
 
Hi,

Plain and simple this cannot be done, unless you invent your own OS.

My thoughts!

NATE
spyderix.gif

design@spyderix-designz.com
 
xorbi,

if you just want to make keyboard shortcuts for buttons, you can use this:

<input type=&quot;button&quot; value=&quot;ALT + P&quot; accesskey=&quot;p&quot; />

pressing alt + p will act like a click on the button.

======================================

if (!succeed) try++
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top