设计一个htm+js+部落冲突l登录代码
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>部落冲突登录</title>
<script type="text/javascript">
function login(){
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
<pre><code> //判断用户名和密码是否为空
if(username == "" || password == ""){
alert("用户名和密码不能为空!");
return;
}
//模拟登录
if(username == "admin" && password == "123456"){
alert("登录成功!");
window.location.href = "https://www.clashofclans.com/";
}else{
alert("用户名或密码错误!");
return;
}
}
</script>
</code></pre>
</head>
<body>
<h1>部落冲突登录</h1>
<form>
<label>用户名:</label>
<input type="text" id="username"><br><br>
<label>密码:</label>
<input type="password" id="password"><br><br>
<input type="button" value="登录" onclick="login()">
</form>
</body>
</html>
AI 优化版
原文地址:https://www.cveoy.top/t/topic/J0f 著作权归作者所有。请勿转载和采集!