3-Digit Password Validator: Simple JavaScript Example
<!DOCTYPE html>
<html>
<head>
<title>3-Digit Password Validator</title>
<script>
function checkPassword() {
var password = document.getElementById('password').value;
if (password.length == 3 && !isNaN(password)) {
alert('Password is correct!');
} else {
alert('Password is incorrect!');
}
}
</script>
</head>
<body>
<h1>3-Digit Password Validator</h1>
<label for='password'>Enter password:</label>
<input type='text' id='password' name='password'>
<button onclick='checkPassword()'>Submit</button>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/jG8a 著作权归作者所有。请勿转载和采集!