zoukankan      html  css  js  c++  java
  • 判断浏览器是否支持某些新属性---placeholder兼容问题解决

    function is_true(){
        return 'placeholder' in document.createElement('input');
    }

    实例:placeholder在低版本IE浏览器下兼容性解决

    <script type="text/javascript"> 
    if( !('placeholder' in document.createElement('input'))){  
        $('input[placeholder],textarea[placeholder]').each(function(){   
              var that = $(this),
              text= that.attr('placeholder');   
              if(that.val()===""){   
                that.val(text);   
              }
              that.focus(function(){   
                if(that.val()===text){   
                      that.val("");   
                }   
              }).blur(function(){   
                if(that.val()===""){   
                      that.val(text);   
                }
              }).closest('form').submit(function(){   
                if(that.val() === text){
                      that.val('');   
                }
              });
        });
    }
    </script> 
  • 相关阅读:
    git merge
    google platform
    http tutorial
    DS,AA tree
    Java,Hashtable
    java,Object
    Pumping lemma for regular languages
    Pumping lemma
    Context-free grammar
    Formal language
  • 原文地址:https://www.cnblogs.com/by-dxm/p/6693311.html
Copyright © 2011-2022 走看看