我有一个Java Script代码,可以改变键盘语言时注重文本框。 但是这个代码只是在IE和Firefox或Opera我的代码工作斜面正常工作:
<script type="text/javascript" language="javascript">
var farsi = true ;
var s = new Array(32,33,34,35,36,37,1548,1711,41,40,215,43,
1608,45,46,47,48,49,50,51,52,53,54,55,56,
57,58,1603,44,61,46,1567,64,1616,1584,125,
1609,1615,1609,1604,1570,247,1600,1548,47,
8217,1583,215,1563,1614,1569,1613,1601,
8216,123,1611,1618,1573,126,1580,1688,
1670,94,95,1662,1588,1584,1586,1610,1579,
1576,1604,1575,1607,1578,1606,1605,1574,
1583,1582,1581,1590,1602,1587,1601,1593,
1585,1589,1591,1594,1592,60,124,62,1617);
//==============================================
function change()
{
var KeyID =event.keyCode;
if(KeyID >= 128)
{
alert("تغيير دهيد EN لطفا زبان صفحه کليد را به");
event.keyCode=0;
return false;
}
if(KeyID > 47 && KeyID < 58) return true;
if(KeyID < 32)return true;
if ( KeyID>32 && KeyID<128) event.keyCode = s[KeyID-32] ;
}
</script>