<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> table { text-align: right; } #pwdTd> img,#pwdTwoTd > img { width: 17px; height: 15px; position: absolute; right: 5px; top: 5px; } #pwdTd,#pwdTwoTd { position: relative; } </style> <script type="text/javascript"> window.onload = function() { var username = document.querySelector("#username"); var pwd = document.querySelector("#pwd"); var pwdTwo = document.querySelector("#pwdTwo"); var usernameText = document.querySelector("#usernameText"); var pwdText = document.querySelector("#pwdText"); var pwdTwoText = document.querySelector("#pwdTwoText"); var phone = document.querySelector("#phone"); var phoneText = document.querySelector("#phoneText"); //绑定失去焦点事件 username.onblur = function() { var usernameV = document.querySelector("#username").value; if (usernameV.length == 0) { usernameText.innerHTML = "账号不能为空"; usernameText.style.color = "red"; usernameText.style.fontSize = "13px" } else { usernameText.innerHTML = ""; } }; username.onfocus = function() { //pwdText.innerHTML = ""; }; //给密码框设置焦点事件 pwd.onblur = function() { var pwdV = document.querySelector("#pwd").value; var reg1 = /^[0-9]{6,20}$/; var reg2 = /^[A-z]{6,20}$/; if (pwdV.length == 0) { pwdText.innerHTML = "密码不能为空"; pwdText.style.color = "red"; pwdText.style.fontSize = "13px"; } else if (pwdV.length < 6) { pwdText.innerHTML = "密码长度不能小于六位"; pwdText.style.color = "red"; pwdText.style.fontSize = "13px"; } else if (reg1.test(pwdV)) { pwdText.innerHTML = "密码过于简单(不能是纯数字)"; pwdText.style.color = "red"; pwdText.style.fontSize = "13px"; } else if (reg2.test(pwdV)) { pwdText.innerHTML = "密码过于简单(不能是纯英文)";
时间: 2023-05-19 19:06:58 浏览: 110
-doctype-html-html-lang-en-dir-ltr-head-meta-name:
这是一个HTML文档的开头部分,其中包含了一些元素和属性。其中,<!DOCTYPE html>是文档类型声明,告诉浏览器这是一个HTML5文档。<html>是HTML文档的根元素,包含了整个文档的内容。<head>是文档头部元素,包含了一些元数据,如字符集、标题、样式表等。<meta charset="utf-8">是设置文档的字符集为UTF-8,确保文档中的中文等非ASCII字符能够正确显示。<title>是设置文档的标题,显示在浏览器的标签页上。<style type="text/css">是定义文档的样式表,其中table { text-align: right; }是设置表格中的文本对齐方式为右对齐。
阅读全文