Hocam aşağıdaki kod her sayfa yenilendiğinde input elementi için farklı class isimleri üretiyor. Eğer php biliyorsan bu fonksiyonu php ye entegre edip html dosyası içinde style tagları arasında rastgele oluşturulan class ismini çekerek kullanabilirsin.
<!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">
<title>Document</title>
</head>
<body>
<input type="text" id="generated-captcha">
<script>
document.querySelector('body').onload = function() {
generate()
}
let captcha;
let alphabets = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";
function generate() {
let first = alphabets[Math.floor(Math.random() * alphabets.length)];
let second = Math.floor(Math.random() * 10);
let third = Math.floor(Math.random() * 10);
let fourth = alphabets[Math.floor(Math.random() * alphabets.length)];
let fifth = alphabets[Math.floor(Math.random() * alphabets.length)];
let sixth = Math.floor(Math.random() * 10);
captcha = first.toString() + second.toString() + third.toString() + fourth.toString() + fifth.toString() + sixth.toString();
document.getElementById('generated-captcha').setAttribute('class', captcha);
};
</script>
</body>
</html>