Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
刷新复选框javascript_Javascript_Html_Checkbox - Fatal编程技术网

刷新复选框javascript

刷新复选框javascript,javascript,html,checkbox,Javascript,Html,Checkbox,我对复选框有问题: 我有两个菜单,打开两种类型的复选框,我想有一个全部选中,另一个不选中,当我刷新页面。代码如下: <div id="Scena" class="tabcontent" onmousedown="if (event.preventDefault) event.preventDefault()"> <input type="checkbox" checked="checked" style="cursor:hand;" onclick="presenter

我对复选框有问题: 我有两个菜单,打开两种类型的复选框,我想有一个全部选中,另一个不选中,当我刷新页面。代码如下:

<div id="Scena" class="tabcontent" onmousedown="if (event.preventDefault) event.preventDefault()">
    <input type="checkbox" checked="checked" style="cursor:hand;" onclick="presenter.toggleInstanceVisibilityByName('Parete_frontale',true);"> Parete_frontale </input>
    <input type="checkbox" checked="checked" style="cursor:hand;margin-left:50px;" onclick="presenter.toggleInstanceVisibilityByName('Parete_destra', true);"> Parete_destra </input>
    <input type="checkbox" checked="checked" style="cursor:hand;margin-left:50px;" onclick="presenter.toggleInstanceVisibilityByName('Parete_sinistra', true);"> Parete_sinistra </input>
    <input type="checkbox" checked="checked" style="cursor:hand;margin-left:50px;" onclick="presenter.toggleInstanceVisibilityByName('Parete_p1', true);presenter.toggleInstanceVisibilityByName('Parete_p2', true);presenter.toggleInstanceVisibilityByName('Parete_p3', true);"> Parete_porta </input><br/> 
</div>

<div id="Indagini" class="tabcontent">
    <input type="checkbox" style="cursor:hand;" onclick="presenter.changeTexture('Parete_p2','back01_cervo.png');setInfoSofia(4);"> Image enhancement </input>
    <input type="checkbox" style="cursor:hand;" onclick="presenter.changeTexture('Parete_destra', 'destra_fluo.png');setInfoSofia(5);"> Analisi di Fluorescenza (LIF) </input>
    <input type="checkbox" style="cursor:hand;" onclick="setInfoSofia(6)"> Efflorescenze saline </input>
    <input type="checkbox" style="cursor:hand;" onclick="presenter.toggleSpotVisibility(HOP_ALL, true); presenter.enableOnHover(!presenter.isOnHoverEnabled()); hotspotSwitch();"> Indagini di caratterizzazione dei materiali </input>
</div>

前翼翼
帕雷特迪斯塔酒店
帕雷特左
港口码头
图像增强 荧光分析(LIF) 风化盐 物质之家酒店
我希望检查id为
Scena
的div的所有子项,并取消检查id为
Indagini
的div的所有子项。 有人能帮我吗?

您可以使用“选中”选项。因此,默认情况下,所有Scena复选框都将选中

<input type="checkbox" checkedstyle="cursor:hand;" onclick="" checked> Image enhancement 
图像增强

首先,它是一个空标记,不能有内容,也不能有结束标记。使用
checked
属性将输入标记为选中。另外请注意,关于FireFox,文档中关于页面刷新和
选中属性的说明。Parete_frontale Parete_destra这是属性为“checked”的代码的一部分,但我希望它也出现在页面刷新中。请不要将代码片段转储到注释中,而是编辑问题。@Sofia_C,我在问题底部看到[javascript]标记。我想你可以编写js函数来刷新页面加载上的复选框,因为id“Scena”我已经完成了,我的问题是页面刷新。我希望一个菜单全部选中,另一个未选中。您可以使用jquery选中选项,('.ScenaClass').prop('checked',true);和('.IndaginiClass').prop('checked',false);这可以通过将类赋予场景一中的所有复选框来实现。但是,没有像
这样的东西。是的,OP需要删除:)欢迎,如果有任何问题,请告诉我$('.ScenaClass').prop('checked',true);忘记在前面的评论中添加$。