美文网首页
h5学习-表单验证

h5学习-表单验证

作者: SeeKmeng | 来源:发表于2019-02-27 19:41 被阅读0次

    1. 在HTML5中,上传文件的时候要设置发送到服务器之前对表单数据进行如何编码

    <form action="" method="post" enctype="multipart/form-data">

             <input type="file" name="file">

    </form>

    2.如何去掉表单在chrome浏览器中记住密码后自动填充的黄色背景?

          1)使用表单属性accomplete=off

          2)使用-webkit-autofill来实现

                input:-webkit-autofill{

                        -webkit-box-shadow:0 0 0px 1000px #2390cc inset;

                }

    3.去除表单输入类型为数字时出现的上下箭头

           input[type='number']::-webkit-inner-spin-button,

           input[type='number']::-webkit-onter-spin-button{

                    -webkit-appearance:none;

                     margin:0;

           }

    4.在表单验证要用setCustomValidity()修改默认提示时,如果没有写obj.setCustomValidity("");这种情况的话,错误提醒不会消失,如:

    function checkit(obj) {

           var it = obj.validity;

           if(it.typeMismatch===true){

                     obj.setCustomValidity("请输入带http://的正确地址!");

           }else{

                     obj.setCustomValidity("");

           }

    }

    相关文章

      网友评论

          本文标题:h5学习-表单验证

          本文链接:https://www.haomeiwen.com/subject/kixxuqtx.html