<!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 == &quot;&quot; || password == &quot;&quot;){
			alert(&quot;用户名和密码不能为空!&quot;);
			return;
		}

		//模拟登录
		if(username == &quot;admin&quot; &amp;&amp; password == &quot;123456&quot;){
			alert(&quot;登录成功!&quot;);
			window.location.href = &quot;https://www.clashofclans.com/&quot;;
		}else{
			alert(&quot;用户名或密码错误!&quot;);
			return;
		}
	}
&lt;/script&gt;
</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>