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


jQWidgets jqxCheckBoxGroup theme屬性用法及代碼示例


jQWidgets是一個 JavaScript 框架,用於為 PC 和移動設備製作基於 Web 的應用程序。它是一個非常強大且優化的框架,獨立於平台,並且得到廣泛支持。這jqxCheckBoxGroupwidget 用於顯示一組複選框,允許用戶選擇或取消選擇複選框組。

主題 屬性用於設置或返回 jqxCheckBoxGroup 小部件的主題。它接受字符串類型值,默認值為空(”)。為了使用此屬性,我們需要將主題樣式表(jqx.energyblue.css)合並到標題部分。主題文件包含在“jqx.base.css” 文件之後。

用法:

  • 設置主題 屬性。
$("#jqxCheckBoxGroup").jqxCheckBoxGroup({ theme: 'energyblue' });
  • 返回 主題屬性。
var theme = $('#jqxCheckBoxGroup').jqxCheckBoxGroup('theme');

鏈接文件:下載jQWidgets從給定的鏈接。在 HTML 文件中,找到下載文件夾中的腳本文件。

<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<link rel=”stylesheet” href=”jqwidgets/styles/jqx.energyblue.css”>
<script type=”text/javascript” src=”scripts/jquery-1.11.1.min.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcheckbox.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcheckboxgroup.js”></script>

示例 1:下麵的示例說明了 jQWidgets jqxCheckBoxGroup 主題 屬性。

HTML


<!DOCTYPE html> 
<html lang="en"> 
  
<head> 
    <link rel="stylesheet" href= 
        "jqwidgets/styles/jqx.base.css" type="text/css" /> 
    <link rel="stylesheet" href= 
        "jqwidgets/styles/jqx.energyblue.css"> 
    <script type="text/javascript"
        src="scripts/jquery-1.11.1.min.js"></script> 
    <script type="text/javascript"
        src="jqwidgets/jqxcore.js"></script> 
    <script type="text/javascript"
        src="jqwidgets/jqxcheckbox.js"></script> 
    <script type="text/javascript"
        src="jqwidgets/jqxcheckboxgroup.js"></script> 
      
    <style> 
        body { 
            margin-left: 100px; 
        } 
  
        .jqxcheckboxgroup { 
            margin-left: 50px; 
        } 
    </style> 
</head> 
  
<body> 
    <center> 
        <h1 style="color: green;"> 
            GeeksforGeeks 
        </h1> 
  
        <h3> 
            jQWidgets jqxCheckBoxGroup theme Property 
        </h3> 
  
        <h4>Select your Company name:</h4> 
  
        <div class='jqxcheckboxgroup'>GfG</div> 
        <div class='jqxcheckboxgroup'>TCS</div> 
        <div class='jqxcheckboxgroup'>Capgemni</div> 
        <div class='jqxcheckboxgroup'>Wipro</div> 
        <br> 
        <input type="button" style="margin: 5px;" 
               id="btn" value="Click here" /> 
        <div id="log"></div> 
  
        <script type="text/javascript"> 
            $(document).ready(function () { 
                $(".jqxcheckboxgroup").jqxCheckBox({ 
                    theme: 'energyblue' 
                }); 
                $("#btn").jqxButton({ 
                    width: 180, 
                    theme: 'energyblue', 
                }); 
                $('#btn').jqxButton(). 
                    click(function () { 
                        var th = 
                            $('.jqxcheckboxgroup').jqxCheckBox('theme'); 
                        $('#log').text(th); 
                    }) 
            });     
        </script> 
    </center> 
</body> 
  
</html>

輸出:

示例 2:下麵是jqxCheckBoxGroup的另一個例子主題 jQWidgets 中的屬性。

HTML


<!DOCTYPE html> 
<html lang="en"> 
  
<head> 
    <link rel="stylesheet" href= 
        "jqwidgets/styles/jqx.base.css" type="text/css" /> 
    <link rel="stylesheet" href= 
        "jqwidgets/styles/jqx.energyblue.css"> 
    <script type="text/javascript"
        src="scripts/jquery-1.11.1.min.js"></script> 
    <script type="text/javascript"
        src="jqwidgets/jqxcore.js"></script> 
    <script type="text/javascript"
        src="jqwidgets/jqxcheckbox.js"></script> 
    <script type="text/javascript"
        src="jqwidgets/jqxcheckboxgroup.js"></script> 
      
    <style> 
        body { 
            margin-left: 100px; 
        } 
  
        .jqxcheckboxgroup { 
            margin-left: 50px; 
        } 
    </style> 
</head> 
  
<body> 
    <center> 
        <h1 style="color: green;"> 
            GeeksforGeeks 
        </h1> 
  
        <h3> 
            jQWidgets jqxCheckBoxGroup theme Property 
        </h3> 
  
        <h4>Select your Company name:</h4> 
  
        <div class='jqxcheckboxgroup'>GfG</div> 
        <div class='jqxcheckboxgroup'>TCS</div> 
        <div class='jqxcheckboxgroup'>Capgemni</div> 
        <div class='jqxcheckboxgroup'>Wipro</div> 
        <br> 
        <input type="button" style="margin: 5px;" 
               id="btn" value="Click here" /> 
        <div id="log"></div> 
  
        <script type="text/javascript"> 
            $(document).ready(function () { 
                $(".jqxcheckboxgroup").jqxCheckBox({ 
                    theme: 'material', 
                }); 
                $("#btn").jqxButton({ 
                    width: 180, 
                }); 
                $('#btn').jqxButton(). 
                    click(function () { 
                        var th = 
                            $('.jqxcheckboxgroup').jqxCheckBox('theme'); 
                        if (th === null) { 
                            $('#log').text("Null!"); 
                        } 
                        else { 
                            $('#log').text("Not null!"); 
                        } 
                    }); 
            }); 
  
        </script> 
    </center> 
</body> 
  
</html>

輸出:

參考: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcheckboxgroup/jqxcheckboxgroup-api.htm?search=



相關用法


注:本文由純淨天空篩選整理自nidhi1352singh大神的英文原創作品 jQWidgets jqxCheckBoxGroup theme Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。