jQuery | jQuery.support属性用法详细解读

2021年3月10日16:10:47 发表评论 577 次浏览

jQuery.support属性jQuery中的包含一组属性, 这些属性用于表示不同的浏览器功能或错误。

语法如下:

jQuery.support.propvalue

参数:该属性包含单个参数资产价值这是必需的。用于指定要测试的功能。包括的测试是:

  • 阿贾克斯
  • boxModel
  • changeBubbles
  • 检查克隆
  • 检查
  • 科尔斯
  • cssFloat
  • hrefNormalized
  • html序列化
  • 前导空格
  • noCloneChecked
  • noCloneEvent
  • 不透明
  • optDisabled
  • optSelected
  • scriptEval()
  • 风格
  • SubmitBubbles
  • 身体

范例1:本示例使用jQuery.support属性向浏览器发送文本以创建XMLHttpRequest对象。

<!DOCTYPE html>
< html >
  
< head > 
     < title >
         jQuery jQuery.support property
     </ title >
      
     < script src =
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" >
     </ script >
</ head > 
  
< body >
     < center >  
         < h1 style = "color:green;" >  
             lsbin
         </ h1 >  
          
         < h2 > jQuery jQuery.support property</ h2 >
          
         < h3 style = "color:lightgreen;" ></ h3 >
          
         <!-- Script to use jQuery.support property -->
         < script >
             $(document).ready(function() {
                 $("h3").html("lsbin is best for"
                         + " Computer Knowledge : " 
                         + jQuery.support.ajax);
             });
         </ script >
     </ center >
</ body >
  
</ html >

输出如下:

jQuery | jQuery.support属性1

范例2:此示例说明了带有cors参数值的jQuery.support属性。

<!DOCTYPE html>
< html >
  
< head > 
     < title >
         jQuery jQuery.support property
     </ title >
      
     < script src =
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" >
     </ script >
</ head > 
  
< body >
     < center >  
         < h1 style = "color:green;" >  
             lsbin
         </ h1 >  
          
         < h2 >jQuery jQuery.support property</ h2 >
          
         < h3 style = "color:lightgreen;" ></ h3 >
          
         <!-- Script to use jQuery.support property -->
         < script src =
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" >
         </ script >
          
         < script >
             $(document).ready(function() {
                 $.support.cors = false;
                 $("h3").html(" Previous Example statement is not"
                         + " correct : " + jQuery.support.cors);
             });
         </ script >
     </ center >
</ body >
  
</ html >

输出如下:

jQuery | jQuery.support属性2

木子山

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: