【问题标题】:How i can control elements from another html?我如何控制来自另一个 html 的元素?
【发布时间】:2014-10-13 08:04:21
【问题描述】:

我在buttons.html 中有按钮标签,在images.html 中有图像标签。 当我从buttons.html打开按钮时,我想从images.html隐藏1张图片。 我该怎么做? 这是buttons.html中的按钮

<div class="onoffswitch">
  <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" checked>
  <label class="onoffswitch-label" for="myonoffswitch"> <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span> </label>
  <img src="image.jpg" /> 
</div>

CSS:

#myonoffswitch ~ img
{
    display:none;
}
#myonoffswitch:checked ~ img
{
    display:block;
}

【问题讨论】:

  • 如何在一个页面上加载多个 html 文件?他们是进口的吗?内嵌框架?
  • 你可能想看看这个链接stackoverflow.com/questions/13545883/…
  • 我需要一个进口源或其他东西,我不知道..

标签: javascript html css image button


【解决方案1】:

改变

    #myonoffswitch ~ img
    {
     display:none;
    }
    #myonoffswitch:checked ~ img
    {
     display:block;
}

.myonoffswitch ~ img
    {
     display:none;
    }
    .myonoffswitch:checked ~ img
    {
     display:block;
}

从我这里开始。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-12-11
    • 2012-10-09
    • 1970-01-01
    • 2013-08-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多