a) If I want to type word ‘call’ second letter ‘l’ in word ‘call’ has to be prevented from entering.
b) If I want to type ‘54662’, after ‘5’, ‘4’, ‘6’ are typed (appeared), second ‘6’ has to be prevented from appearing in the text while I’m pressing key ‘6’.
c) It is ok with word ‘olala’. It should not be prevented from entering.
<body> <input id="texid" type="text" onkeypress="return uniCharCode(event)" > <script> function uniCharCode(event) { var char = event.keyCode; var char1 = String.fromCharCode(char); var go = document.getElementById("texid").value; var lengthh = go.length; var gol = go.substring(lengthh-1); /*if(gol != char1){ return true; } else{ return false; }*/ return true; } </script> </body>
Thanks for any feedback in advance.