AI
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<title>Document</title>
</head>
<style>
.bevitel
{
margin-left: auto;
margin-right: auto;
}
</style>
<body>
<div class="container" style="width: 170px;">
<div class="bevitel" style="text-align: center;">
<div class="mb-3">
<label for="ipinput" class="form-label">R</label>
<input type="text" style="text-transform: uppercase" class="form-control" id="rendszamok" minlength="3" maxlength="17" onkeyup="rendszam();">
</div>
<div class="mb-3">
<label for="ipinput" class="form-label">L</label>
<input type="text" class="form-control" id="lottozas" onkeyup="lotto();">
</div>
</div>
</div>
<script>
function rendszam()
{
let input = document.getElementById("rendszamok");
let regex =/[A-Z]{2} [A-Z]{2}-[0-9]{3}/g;
let val = input.value.replace(" ", "").substring(0,4).toLowerCase();
let tiltott = ["szar","kuki","kaki","pisi","nuni","fing"];
console.log(!tiltott.includes(val))
if(regex.test(input.value.toUpperCase()) && !tiltott.includes(val))
{
input.classList.remove("is-invalid");
input.classList.add("is-valid");
return
}
input.classList.remove("is-valid");
input.classList.add("is-invalid");
}
function lotto()
{
let input = document.getElementById("lottozas");
let regex =/[0-9]{1,2};[0-9]{1,2};[0-9]{1,2};[0-9]{1,2};[0-9]{1,2}/g;
let val = input.value.replace(" ", "").split(";");
var valid = true
var set = new Set();
for (let i = 0; i < val.length; i++) {
let num = parseInt(val[i])
set.add(num);
if(val[i][0] == 0 || num < 1 || num > 90 || num == undefined)
{
valid = false;
break
}
}
if(regex.test(input.value) && valid && set.size == 5)
{
input.classList.remove("is-invalid");
input.classList.add("is-valid");
return
}
input.classList.remove("is-valid");
input.classList.add("is-invalid");
}
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>
| |