Янковиц,
где пример с проблемой?
в коде ниже её нет.
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<textarea name="" rows="8">
test
test
</textarea>
<script>
function translit_to_eng(txt) {
match = new Array
("a","b","v","q","d","e","ə","j","z","i","y","k","l","m","n","o","p", "r","s","t","u","f","x","c","ç","ş","h","ı","ğ","g","ö","ü","A","B", "V","Q","D","E","Ə","J","Z","İ","Y","K","L","M","N","O","P","R", "S","T","U","F","X","C","Ç","Ş","H","I","Ğ","G","Ö","Ü","1","2","3","4","5","6","7","8","9","0","?","!","-"," ",":",",",".","\n");
replace = new Array
("а","б","в","г","д","е","ә","ж","з","и","ј","к","л","м","н","о","п", "р","с","т","у","ф","х","ҹ","ч","ш","һ","ы","ғ","ҝ","ө","ү","А","Б", "В","Г","Д","Е","Ә","Ж","З","И","Ј","К","Л","М","Н","О","П","Р", "С","Т","У","Ф","Х","Ҹ","Ч","Ш","Һ","Ы","Ғ","Ҝ","Ө","Ү","1","2","3","4","5","6","7","8","9","0","?","!","-"," ",":",",",".","\n");
Input = txt;
Output = "";
for(var i=0;i<Input.length;i++) {
ch = "";
for(var j=0;j<match.length;j++)
if(Input.charAt(i) == match[j])
ch = replace[j];
Output += ch;
}
return Output;
}
var elem = document.querySelector("textarea"),
text = elem.value;
elem.value = translit_to_eng(text)
</script>
</body>
</html>