HELP : Capture event function keys - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

HELP : Capture event function keys

jxhembullajxhembulla Posts: 5Member
I am working on a wysiwyg editor and I want users to be able to insert special characters like or other characters, I do this by using the event.keycode function. My problem is that I want some other functions handled by my function keys F7-F12, but the problem is that each of this function has the same keyCode as some letters. For example F12 has its keycode=123, when character "{" has the same keycode. Is there any possible way to find out if the F12 key is pressed and differentiate from the "{" character so I can imlement different behaivor.

By the way I need it just for IE 6+

Thanx

Comments

  • zibadianzibadian Posts: 6,349Member
    : I am working on a wysiwyg editor and I want users to be able to insert special characters like or other characters, I do this by using the event.keycode function. My problem is that I want some other functions handled by my function keys F7-F12, but the problem is that each of this function has the same keyCode as some letters. For example F12 has its keycode=123, when character "{" has the same keycode. Is there any possible way to find out if the F12 key is pressed and differentiate from the "{" character so I can imlement different behaivor.
    :
    : By the way I need it just for IE 6+
    :
    : Thanx
    :
    Function keys are extended keys, which means that they have 2 key-codes: #0 and the actual key-code. To catch them, you first need to catch the #0 code and remember that, then catch the actual key-code and process that differently from non-extended keys (like {).
  • jxhembullajxhembulla Posts: 5Member
    : : I am working on a wysiwyg editor and I want users to be able to insert special characters like or other characters, I do this by using the event.keycode function. My problem is that I want some other functions handled by my function keys F7-F12, but the problem is that each of this function has the same keyCode as some letters. For example F12 has its keycode=123, when character "{" has the same keycode. Is there any possible way to find out if the F12 key is pressed and differentiate from the "{" character so I can imlement different behaivor.
    : :
    : : By the way I need it just for IE 6+
    : :
    : : Thanx
    : :
    : Function keys are extended keys, which means that they have 2 key-codes: #0 and the actual key-code. To catch them, you first need to catch the #0 code and remember that, then catch the actual key-code and process that differently from non-extended keys (like {).
    :

    how do I catch the #0 code, like :
    if (event.keyCode==0)
    or something like this or should I do the check for actual keycode first and after that check for code #0.
  • zibadianzibadian Posts: 6,349Member
    : : : I am working on a wysiwyg editor and I want users to be able to insert special characters like or other characters, I do this by using the event.keycode function. My problem is that I want some other functions handled by my function keys F7-F12, but the problem is that each of this function has the same keyCode as some letters. For example F12 has its keycode=123, when character "{" has the same keycode. Is there any possible way to find out if the F12 key is pressed and differentiate from the "{" character so I can imlement different behaivor.
    : : :
    : : : By the way I need it just for IE 6+
    : : :
    : : : Thanx
    : : :
    : : Function keys are extended keys, which means that they have 2 key-codes: #0 and the actual key-code. To catch them, you first need to catch the #0 code and remember that, then catch the actual key-code and process that differently from non-extended keys (like {).
    : :
    :
    : how do I catch the #0 code, like :
    : if (event.keyCode==0)
    : or something like this or should I do the check for actual keycode first and after that check for code #0.
    :
    I've never done this in javascript, but in othr languages it looks something like this:
    [code]
    if (KeyCode==0)
    {
    // Extended key
    if (KeyCode==SomeValue)
    {
    // Process key
    } else ....
    } else {
    // Normal key
    if (KeyCode==SomeValue)
    {
    // Process key
    } else ....
    }
    [/code]
    I don't know if it works in javascript.
  • jxhembullajxhembulla Posts: 5Member
    : : : : I am working on a wysiwyg editor and I want users to be able to insert special characters like or other characters, I do this by using the event.keycode function. My problem is that I want some other functions handled by my function keys F7-F12, but the problem is that each of this function has the same keyCode as some letters. For example F12 has its keycode=123, when character "{" has the same keycode. Is there any possible way to find out if the F12 key is pressed and differentiate from the "{" character so I can imlement different behaivor.
    : : : :
    : : : : By the way I need it just for IE 6+
    : : : :
    : : : : Thanx
    : : : :
    : : : Function keys are extended keys, which means that they have 2 key-codes: #0 and the actual key-code. To catch them, you first need to catch the #0 code and remember that, then catch the actual key-code and process that differently from non-extended keys (like {).
    : : :
    : :
    : : how do I catch the #0 code, like :
    : : if (event.keyCode==0)
    : : or something like this or should I do the check for actual keycode first and after that check for code #0.
    : :
    : I've never done this in javascript, but in othr languages it looks something like this:
    : [code]
    : if (KeyCode==0)
    : {
    : // Extended key
    : if (KeyCode==SomeValue)
    : {
    : // Process key
    : } else ....
    : } else {
    : // Normal key
    : if (KeyCode==SomeValue)
    : {
    : // Process key
    : } else ....
    : }
    : [/code]
    : I don't know if it works in javascript.
    :


    in some forums I've seen it somethinfg like
    if (event.charCode==0)
    { if event.keyCode=[function keys]
    //do something here
    }

    but this does not work for me because now it always gives me the value of 0, ex. : F10 key works the same as 'y' character and either I can allow both or block both (very strange).
    anyway thanx for answers
Sign In or Register to comment.