3

在我的安装程序中的一个表单上,我有一组复选框。现在我想要另一个复选框,选中后将选中其他复选框

有谁知道如何实现这一目标?

谢谢

4

3 回答 3

3

在复选框表单组件的“选择脚本”属性中,添加以下代码:

((JCheckBox)formEnvironment.getFormComponentById("123").
      getConfigurationObject()).setSelected(selected);

其中“123”必须替换为应选择的其他表单组件的 ID。

于 2013-07-10T07:53:24.063 回答
0

使用 jQuery 之类的东西很简单:

<script>
$(document).ready(function(){
    // On clicking the master, check all checkbox
    $("#checkall").click(function() {
        // find all checkboxes with the class 'checkboxes'
        // and make it checked/unchecked to match the master checkbox
        $('input[type="checkbox"].checkboxes')
           .attr("checked", $(this).is(":checked"))
       ;
    });
});
</script>

添加一个简单的复选框以充当主人以启用/禁用其余部分

<input title="Check all" id="checkall" 
       type="checkbox" class="checkbox" value="1" 
/>

<input class="checkboxes checkbox" type="checkbox" />
<input class="checkboxes checkbox" type="checkbox" />
<input class="checkboxes checkbox" type="checkbox" />
于 2013-07-08T15:40:38.320 回答
0

你可以使用一个简单的javascript来做到这一点:

<div id="page">
<p>
<input id="chkFile1" type="checkbox" title="File 1" />File 1</p>
<p>
<input id="chkFile2" type="checkbox" title="File 2" />File 2</p>
<p>
<input id="chkFile3" type="checkbox" title="File 3" />File 3</p>
<p>
<input id="chkFile4" type="checkbox" title="File 4" />File 4</p>
<p>
<input id="chkFile5" type="checkbox" title="File 5" />File 5</p>
<p>
<input id="chkAllFiles" type="checkbox" title="All Files"  onchange="selectAllFiles(this.checked);" />All Files</p>
</div>

然后是脚本:

<script type="text/javascript">
    function selectAllFiles(c) {
       for (i = 1; i <= 5; i++) {
           document.getElementById('chkFile' + i).checked = c;
       }
    }
</script>
于 2013-07-08T15:47:28.327 回答