JavaScript:网页简单加密

Posted by: NOTEPAD 2018年9月11日 Leave a comment

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
</head>
<script type="text/javascript">
	loopy();
			function loopy() {
				var sWord = prompt("输入正确密码才能登陆!","");
				var password = "123456";
				var isCancle = false;
				while(sWord!=password){
					if(sWord==null){
						isCancle = true;
						break;
					}else{
						sWord = prompt("输入正确密码才能登陆!","");
					}
				}
				if(!isCancle){
					alert("密码正确谢谢你的光临!");
				}else{
					location.replace("about:blank");
					window.close();
				}
			}
</script>
<body>
 
</body>
</html>