我有一个 Java 脚本代码,当专注于文本框时可以更改键盘语言。但是这段代码只能在 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>