大家可以帮我看看怎么实现输入正确后跳转到其他网页,有什么其他的建议也是可以提出来
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>邀请码</title>
</head>
<body>
<label for="password">邀请码:</label>
<input type="password" id="password" name="password">
<button onclick="checkPassword()">提交</button>
<script>
function checkPassword() {
var password = document.getElementById("password").value;
if (password === "123456") {
alert("邀请码正确");
} else {
alert("邀请码错误");
}
}
</script>
</body>
</html>
邀请码html
于 2023-07-27 15:54:38 首次发布
该HTML代码片段展示了一个简单的邀请码验证功能,用户在输入框中输入邀请码,点击提交后,JavaScript函数`checkPassword()`会检查输入是否为123456。如果输入正确,弹出提示信息,否则显示错误提示。若要实现输入正确后跳转,需在验证成功时添加页面重定向代码。
摘要由CSDN通过智能技术生成