...

View Full Version : changing a textbox language



almanden
01-29-2009, 06:02 PM
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);
}
}

Philip M
01-29-2009, 06:34 PM
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.

freedom_razor
01-29-2009, 09:17 PM
cha rCodeAt(key-32);


Also, I think there's a extra space there which should be removed.

charCodeAt(key-32);

almanden
01-30-2009, 09:04 AM
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


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
01-30-2009, 10:02 AM
Do any one help me?
its urgent

almanden
01-30-2009, 03:01 PM
Are there any idea for solving my problem?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum