Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    changing a textbox language

    I have below code to change a textbox language that works fine in IE
    but i want to write for firefox.
    i have tried e.which instead window.event.keyCode for firefox but
    it seems to be read only.
    Do anyone help me
    thanks in advance

    function keyenter(field,e)
    {
    var key;
    if (window.event)
    key = window.event.keyCode;

    if (key > 31)
    if (key < 128)
    {
    if (window.event)
    window.event.keyCode = ' !"#$%،گ)(×+و-./0123456789:ك,=.؟@ِذ}ىُيلا÷ـ،/’د×؛َءٍف‘{ًْإ~جژچ^_پشذزيثب لاهتنمئدخحضقسفعرصطغظ<|>ّ'.cha rCodeAt(key-32);
    }
    }


  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,147
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    Code:
    function keyenter(field,ev) {
    var key;
    if (window.event) {
    ev = ev || event;
    key = ev.keyCode;

    A man explained inflation to his wife thus: 'When we married, you measured 36-24-36. Now you're 42-42-42. There's more of you, but you are not worth as much.

  • Users who have thanked Philip M for this post:

    almanden (01-30-2009)

  • #3
    Regular Coder
    Join Date
    Dec 2008
    Location
    Tannhäuser Gate
    Posts
    286
    Thanks
    7
    Thanked 58 Times in 57 Posts
    Quote Originally Posted by almanden View Post
    Code:
    cha rCodeAt(key-32);
    Also, I think there's a extra space there which should be removed.
    Code:
    charCodeAt(key-32);

  • Users who have thanked freedom_razor for this post:

    almanden (01-30-2009)

  • #4
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    Code:
    function keyenter(field,ev) {
    var key;
    if (window.event) {
    ev = ev || event;
    key = ev.keyCode;

    A man explained inflation to his wife thus: 'When we married, you measured 36-24-36. Now you're 42-42-42. There's more of you, but you are not worth as much.

    Now I have the code below
    Code:
    function keyenter(field,e)
    {
    debugger
    var key;
    //if (window.event || e.which)
    e = e || window.event;
    if(!e.which)
    key=e.keyCode
    else
    key=e.charCode
    
    if (key > 31)
    if (key < 128)
    {
    
    if (window.event)
    e.keyCode=' !"#$%،گ)(×+و-./0123456789:ك,=.؟@ِذ}ىُيلا÷ـ،/’د×؛َءٍف‘{ًْإ~جژچ^_پشذزيثبلاهتنمئدخحضقسفعرصطغظ<|>ّ'.charCodeAt(key-32);
    else if(e)
    e.charCode=' !"#$%،گ)(×+و-./0123456789:ك,=.؟@ِذ}ىُيلا÷ـ،/’د×؛َءٍف‘{ًْإ~جژچ^_پشذزيثبلاهتنمئدخحضقسفعرصطغظ<|>ّ'.charCodeAt(key-32);
    
    }
    }
    and i get an error at the line after else if(e)
    which indicate that e.charCode is only a getter
    how can i solve this problem?
    it should be mentioned that event rise on onkeypress event
    sorry for my bad english

  • #5
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Do any one help me?
    its urgent

  • #6
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Are there any idea for solving my problem?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •