Blogger Information
Blog 35
fans 0
comment 1
visits 42640
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
批量禁止input框,disabled
魏先生的博客
Original
1044 people have browsed it

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <input type="text" />
        <input type="text" />
        <input type="button" id="btn" value="搜索" />
        <script type="text/javascript">
            var btn = document.getElementById('btn');
            var inps = document.getElementsByTagName('input');
            btn.onclick = function(){
                for(var i=0;i<inps.length;i++){
                    inp = inps[i];
                    if(inp.type === 'text'){  //全等于>>>>很重要
                        inp.disabled = true;
                    }
                    
                }
            }
        </script>
    </body>
</html>

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post