Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-29-2009, 06:02 PM   PM User | #1
almanden
New to the CF scene

 
Join Date: Jan 2009
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
almanden is an unknown quantity at this point
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);
}
}

almanden is offline   Reply With Quote
Old 01-29-2009, 06:34 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,032
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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.
Philip M is offline   Reply With Quote
Users who have thanked Philip M for this post:
almanden (01-30-2009)
Old 01-29-2009, 09:17 PM   PM User | #3
freedom_razor
Regular Coder

 
Join Date: Dec 2008
Location: Tannhäuser Gate
Posts: 286
Thanks: 7
Thanked 58 Times in 57 Posts
freedom_razor is an unknown quantity at this point
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);
freedom_razor is offline   Reply With Quote
Users who have thanked freedom_razor for this post:
almanden (01-30-2009)
Old 01-30-2009, 09:04 AM   PM User | #4
almanden
New to the CF scene

 
Join Date: Jan 2009
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
almanden is an unknown quantity at this point
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
almanden is offline   Reply With Quote
Old 01-30-2009, 10:02 AM   PM User | #5
almanden
New to the CF scene

 
Join Date: Jan 2009
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
almanden is an unknown quantity at this point
Do any one help me?
its urgent
almanden is offline   Reply With Quote
Old 01-30-2009, 03:01 PM   PM User | #6
almanden
New to the CF scene

 
Join Date: Jan 2009
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
almanden is an unknown quantity at this point
Are there any idea for solving my problem?
almanden is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 11:56 AM.


Advertisement
Log in to turn off these ads.