mirror of
https://github.com/skidoodle/taj-validator.git
synced 2025-03-05 20:00:40 +01:00
final ver
This commit is contained in:
parent
2180538627
commit
efd76b27a2
4 changed files with 13 additions and 28 deletions
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"trailingComma": "es5",
|
||||
"tabWidth": 2,
|
||||
"semi": true,
|
||||
"singleQuote": true
|
||||
}
|
|
@ -1,20 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="hu">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>TAJ Validator</title>
|
||||
<script src="script.js" async></script>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<link rel="stylesheet" href="style.css" />
|
||||
<script async src="script.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>TAJ Validator</h1>
|
||||
|
||||
<form>
|
||||
<input type="text" id="taj" oninput="restrictInput(this, 'number')" />
|
||||
<button type="submit" onclick="checkTAJ()">Ellenőrzés</button>
|
||||
</form>
|
||||
|
||||
<p id="result"></p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
// Input 0
|
||||
function restrictInput(a) {
|
||||
a.value = a.value.replace(/[^0-9]/g, "").slice(0, 9);
|
||||
}
|
||||
|
@ -7,7 +6,7 @@ function validateTAJ(a) {
|
|||
if (9 != a.length) {
|
||||
return !1;
|
||||
}
|
||||
for (var c = 0, d = "", b = 0; b < a.length; b++) {
|
||||
for (var c = 0, d = '', b = 0; b < a.length; b++) {
|
||||
7 >= b && (c += 0 == (b + 1) % 2 ? 7 * parseInt(a[b]) : 3 * parseInt(a[b]), d += a[b]);
|
||||
}
|
||||
return a == d + c % 10;
|
||||
|
@ -19,5 +18,4 @@ function checkTAJ() {
|
|||
c.textContent = a ? "A TAJ sz\u00e1m \u00e9rv\u00e9nyes." : "A TAJ sz\u00e1m \u00e9rv\u00e9nytelen.";
|
||||
c.style.color = a ? "#4CAF50" : "#FF5733";
|
||||
return a;
|
||||
}
|
||||
;
|
||||
};
|
21
style.css
21
style.css
|
@ -1,35 +1,32 @@
|
|||
body,
|
||||
input {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #121212;
|
||||
color: #338ef7;
|
||||
text-align: center;
|
||||
font-size: 1.5rem;
|
||||
margin: 10% auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
form {
|
||||
max-width: 300px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
label,
|
||||
input {
|
||||
input,
|
||||
label {
|
||||
margin: 10px 0;
|
||||
color: #338ef7;
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
border: 1px solid #338ef7;
|
||||
border-radius: 5px;
|
||||
background-color: #333;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: #338ef7;
|
||||
color: #efefef;
|
||||
|
@ -39,14 +36,12 @@ button {
|
|||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
font-weight: bold;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
input::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
input[type='number'] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue