VolodinAS,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<input type="text" name="mkb">
<script>
let input = document.querySelector('[name="mkb"]')
input.addEventListener("keydown", function(event) {
let { code, key } = event;
let { length } = input.value;
if (['Delete', 'Backspace'].includes(code)) return;
event.preventDefault();
if (!length) {
if (/^Key[A-Z]$/.test(code)) {
input.value += code.slice(-1);
}
}
if ([1, 2, 4].includes(length)) {
if (/^Digit\d$/.test(code)) {
input.value += code.slice(-1);
}
}
if (length == 3) {
if (key === '.') {
input.value += key;
}
}
});
</script>
</body>
</html>