当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


JQuery jQuery.support用法及代码示例


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

用法:

jQuery.support.propvalue

参数:该属性包含必需的单个参数propvalue。用于指定要测试的函数。包括的测试是:


  • ajax
  • boxModel
  • changeBubbles
  • checkClone
  • checkOn
  • cors
  • cssFloat
  • hrefNormalized
  • htmlSerialize
  • leadingWhitespace
  • noCloneChecked
  • noCloneEvent
  • opacity
  • optDisabled
  • optSelected
  • scriptEval()
  • style
  • submitBubbles
  • tbody

范例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;" >   
            GeeksForGeeks 
        </h1>   
          
        <h2> jQuery jQuery.support property</h2> 
          
        <h3 style="color:lightgreen;" ></h3> 
          
        <!-- Script to use jQuery.support property -->
        <script> 
            $(document).ready(function() { 
                $("h3").html("GeeksForGeeks is best for" 
                        + " Computer Knowledge : "  
                        + jQuery.support.ajax); 
            }); 
        </script> 
    </center> 
</body> 
  
</html>  

输出:

范例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;" >   
            GeeksForGeeks 
        </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>  

输出:



相关用法


注:本文由纯净天空筛选整理自SHUBHAMSINGH10大神的英文原创作品 jQuery | jQuery.support Property。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。