MasterMax1313
New Member
- Messages
- 84
- Reaction score
- 0
- Points
- 0
what i'm trying to do is capture certain types of key events with javascript. it's akin to using the text editor for the forums here, if you press ctrl+b then the text is bold, but the bookmarks don't come up.
in my application i can get the event captured, the equivalent to making the text bold, but the bookmarks still come up.
so basically i'm looking to make some hotkeys. any suggestions are appreciated
in my application i can get the event captured, the equivalent to making the text bold, but the bookmarks still come up.
so basically i'm looking to make some hotkeys. any suggestions are appreciated
Code:
document.onkeydown = KeyCheck;//ctrlChk;
document.onkeyup = ctrlChk;//KeyCheck;
function ctrlChk(e)
{
var KeyID = (window.event) ? event.keyCode : e.keyCode;
if(KeyID == 17)
{
ctrl = false;
}
}
function KeyCheck(e)
{
var KeyID = (window.event) ? event.keyCode : e.keyCode;
if(KeyID == 17)
ctrl = true;
if(window.event)
{
window.event.keyCode = 555;
alert(event.keyCode);
}
else
{
window.e.keyCode = 555;
alert(e.keyCode);
}
switch(KeyID)
{
/*case 17: // 'ctrl' - modifier key
ctrl = true;
break;*/
case 19: //'pause' - pause/resume tourney
tourneyGoing = !tourneyGoing;
break;
case 27: // 'esc' - remove '-'
Escape();
break;
case 109: // '-' - wait for key for removal
keypressMinus();
break;
default:
break;
}
if(ctrl)
{
switch(KeyID)
{
--snip--