I have above script, CheckFiddle or below
<script type="text/javascript">
function check(e){
var text = e.keyCode ? e.keyCode : e.charCode;
switch(text){
case 81:
text = 'መ';
break;
case 87:
text = 'ሙ';
break;
case 69:
text = 'ሚ';
break;
case 82:
text = 'ማ';
break;
case 84:
text = 'ሜ';
break;
case 89:
text = 'ም';
break;
case 85:
text = 'ሞ';
break;
}
if(text == 8){
var str = document.getElementById("out").innerHTML;
var foo = str.substring(0, str.length -1);
document.getElementById("out").innerHTML = foo;
}else {
document.getElementById("out").innerHTML += text;
}
}
</script>
<input type='text' onkeyup='check(event);' id='in' />
<div id='out' ></div>
Which changes only some of the qwerty
letters to another unicodes as they get typed. meaning, each letter gets converted to another letter, but the problem is, there are some letters that can only be created with a combination of two key strokes, together or separately. i.e.
- when you press m then quickly, o it should generate x;
- or when you press shift + p it, it should generate y
The problem, here is that the code only recognized one letter per stroke. I tried using:
if(text == 77+79){ // this is for m + o
text 'x';
}
or even for the shift + p which should output z. I the above argument it inside, but it is not working.