DOM实作 密码输入

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>passWordPlus</title>
    <style>
        input,img,p{
            margin: 0px;padding: 0px;
        }
        div{
            display: inline-block;
            position: relative;
        }
        p{
            display: inline-block;
            position: relative;
            left: 15px;
            font-size: 5px;    
        }
        img{
            width: 27px;    
            display:none;
        }
        .iconChange{
            display: block;
            position: absolute;
            left: -5px;
            bottom:-2px;   
        }
        


    </style>
</head>
<body>
    <input id="passWord" type="password">
    <div>
        <img src=""  >  <!--行内权重比较大 不能放行内-->
        <p>密码需6~16位</p>
    </div>
    <script>
        var input = document.getElementById("passWord")
        var icon = document.querySelector('img')
        var hint = document.querySelector("p")

        input.onblur=function(){
            if(input.value.length<6 || input.value.length>16){
                hint.innerHTML="**请注意***密码需6~16位";
                icon.className="iconChange"
                icon.src="img/x.png";
                
            }else{
                hint.textContent=""
                icon.className="iconChange"
                icon.src="img/v.jpg" 
            }
        }

    </script>
</body>
</html>

<<:  第一次进入赌场是否要搞懂一下规则 - 永丰金 Shioaji API 初探

>>:  Day1 每个人都有一个财富自由梦

Microsoft Azure Pass 学习日志 Day 2

Chap.I Compute Services 计算服务 Part 1. Virtual Machi...

【Day 16】jQuery事件

jQuery事件 说明:是为响应 HTML 页面中的事件而订制的。 何谓事件(Events)? 网页...

[Day7] - Django 专案设定,创建 Django app

前一天当中,我们一起完成了第一个最基本的 Django 网站。 这次要来介绍一下Django 专案里...

Day 22 ctop 好用的 docker 容器监控工具

图形化介面对於人们来说,若将其用於监测用途上,比起密密麻麻的数字表格,会是相当友善的工具。若想要监测...

Day27,Kubesphere 体验

正文 先把nfs-client设定为default storage class kubectl pa...