當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。