Code:
<script type="text/javascript">
Array.prototype.combine = function(arr) {
if(arguments.length > 1 || !(arr instanceof Array))
arr = Array.prototype.slice.apply(arguments);
for(var i = 0, r = []; i < this.length; ++i)
for(var j = 0, e = this[i]; j < arr.length; ++j)
r.push(this[i] + arr[j]);
return r;
};
var vowels = ["a", "ā", "i", "ī", "u", "ū", "e", "ē", "ai", "o", "ō", "au"],
consonants = [
"k", "ṅ", "c", "ñ", "ṭ", "ṇ", "t", "n", "p",
"m", "y", "r", "l", "v", "ẓ", "ḻ", "ṛ", "ḷ", "ṟ", "R", "ṉ", "N",
"j", "ṣ", "s", "h", "kṣ"
];
</script>
<form action="" onsubmit="return false;">
<input type="text" style="width: 2em;" onkeyup="
this.form.elements['uyirmei'].value =
(consonants.indexOf(this.value) > -1) ?
[this.value].combine(vowels).join(' ') :
'';
">
<textarea name="uyirmei"></textarea>
</form>
Bookmarks