<script>alert("abc")</script>

wwwwww

转载于:https://www.cnblogs.com/kongnn/p/5070882.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
<!DOCTYPE html> <html> <head> <title>登录界面</title> <meta charset="utf-8" /> <title></title> </head> <style> input[type="text"], input[type="password"] { display: block; width: 5%; padding: 10px; margin-bottom: 20px; border-radius: 5px; border: 1px solid #ccc; font-size: 1.2em; } body{ background: url(image/java.jpg) top left; width: 10240px; height: 5120px; background-attachment: fixed; background-repeat: no-repeat; background-size: 100%; } 00 input[type="submit"] { background-color: Transparent; color: #abc1ee; padding: 10px 20px; border-radius: 5px; border: none; font-size: 1.2em; cursor: pointer; } a { text-decoration-line: none; color: #abc1ee; } </style> <body> <div id="div-title"> <h3>Welcome to Login</h3> </div> <div class="container"> <div class="header">Login</div> <div class="form-wrapper"> <input type="text" name="username" placeholder="username" id="username"> <input type="password" name="password" placeholder="password" id="password"> <input type="submit" value="Login" onclick="validate()"> </div> <div class="msg"> Don't have account? <a href="#">Sign up</a> </div> </div> <script> // 定义全局变量 var usernameInput = document.getElementById("username"); var passwordInput = document.getElementById("password"); var errorCount = 0; function validate() { // 定义局部变量 var username = usernameInput.value; var password = passwordInput.value; // switch...case语句 switch (username) { case "": alert("用户名不能为空"); errorCount++; break; case "admin": if (password === "admin") { alert("登录成功"); } else { alert("密码错误"); errorCount++; } break; default: alert("用户名不存在"); errorCount++; break; } // for...in语句 for (var i in username) { if (username[i] === " ") { alert("用户名不能包含空格"); errorCount++; break; } } // if语句 if (password === "") { alert("密码不能为空"); errorCount++; } // 调用函数 displayError(); if (errorCount >= 3) { alert("错误次数过多,请稍后再试"); window.location.reload(); } } function displayError() { // 获取元素 var container = document.querySelector(".container"); // 创建元素节点 var errorDiv = document.createElement("div"); errorDiv.innerHTML = "输入有误,请重新输入"; errorDiv.style.color = "red"; // 对子节点的操作 container.appendChild(errorDiv); setTimeout(function() { container.removeChild(errorDiv); }, 3000); } </script> </body> </html>对这个界面进行优化,添加标签
最新发布
06-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值