• 2019.10.20


    1.【html】placeholder如何在兼容IE?

        我的答案:不知道❌

        百度见解: placeholder 正常只能兼容到IE10,

              解决办法:在页面底部引入这段脚本,注意,本段脚本是jquery语法,在这之前需要引入jquery

                <script type="text/javascript">   

                if( !('placeholder' in document.createElement('input')) ){   //如果 创建的input标签中没有placeholder这个属性

    // 匹配 除type=password以外所有input、textarea

                    $('input[placeholder],textarea[placeholder]').each(function(){    //遍历所有的 input 和  textarea (有placeholder属性的)

                      var that = $(this),    

                      text= that.attr('placeholder');    //获取当前遍历到的这个对象的placeholder

    1. // 如果内容为空,则写入

                      if(that.val()===""){    //如果当前这个对象的Value值是空

                        that.val(text).addClass('placeholder');    //就让这个对象的值等于text,并增加类名placeholder

                      }  

          1.  // 控件激活,清空placeholder

                  that.focus(function(){    //当光标聚集   函数

                      if(that.val()===text){    //如果这个input标签的value值等于text

                        that.val("").removeClass('placeholder');    //就让当前value值为空,并移除placeholder类

                        }    

                      })    

               // 控件失去焦点,清空placeholder

                .blur(function(){    //当光标离开   函数

                  if(that.val()===""){    //如果这个input标签的value值等于空

                    that.val(text).addClass('placeholder');    //就让这个标签的value值等于 text,并添加这个placeholder类

                }    

              })    

                .closest('form').submit(function(){    //当关闭from表单,提交

                    if(that.val() === text){    //这个input的值等于text

                        that.val('');    //就让这个表单的value值为空

                }    

              });    

            });    

          }   

        </script>

    ————————————————

    版权声明:本文为CSDN博主「木心Do」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。

    原文链接:https://blog.csdn.net/qq_33505829/article/details/81672287

    2.【css】相邻兄弟选择器、后代选择器、和子选择器三者有什么区别?

        我的答案:相邻兄弟选择器就是只选择它前一个和后一个相邻的兄弟元素;

             后代选择器就是选择它后代中的所有这个元素,包括孙子级别或以下;

             子代选择器就是选择它儿子中的所有这个元素,不包括孙子级别和以下;

        百度见解:

    3.【js】你有使用过FileReader吗?说说它有哪些应用场景?

        我的答案:不知道❌

        百度见解:

  • 相关阅读:
    dos
    jsf session的获取和添加
    tomcat多开造成的端口占用
    myeclipse中tomcat7内存大小的设置
    中文传值乱码过滤
    java定时器
    jsf中jstl标签<c:forEach/>打印信息
    python基础python函数any()与all()的区别
    C# GetManifestResourceStream获取资源为null
    Linux kill 9 和 kill 15 的区别
  • 原文地址:https://www.cnblogs.com/hou-yuan-zhen/p/11710792.html
Copyright © 2020-2023  润新知