简体   繁体   English

为什么此html代码复选框适用于Firefox和Chrome,但不适用于IE?

[英]Why this code for html checkbox works for Firefox and Chrome, but not for IE?

This is related to my previous question : Why html checkbox function only works in IE but not in Firefox or Chrome? 这与我以前的问题有关: 为什么html复选框功能仅在IE中起作用,而在Firefox或Chrome中却不起作用?

Why the following code does not work in IE : 为什么以下代码在IE中不起作用:

<body>

<script type="text/javascript">
  function checkAdvSearch(checked)
  {
    console.log("Test");
    if (checked==1)
    {
      document.getElementById("searchTerm2").style.display='';
      document.getElementById("searchField2").style.display='';
    }
    else
    {
      document.getElementById("searchTerm2").style.display='none';
      document.getElementById("searchField2").style.display='none';

      document.getElementById("searchTerm2").value='';
      document.getElementById("searchField2").value='Client Name';
    }
  }
</script>

  <input type="checkbox" name="advSearch" onclick="checkAdvSearch(this.checked);" checked />Advanced Search
  <input type="text" id="searchTerm2" value="" />
  <select id="searchField2" value="clientName" >
    <option>Client Name</option>
    <option>Policy Number</option>
  </select>

</body>
</html>

When I uncheck the box, the other 2 items are supposed to go away, but in IE there is no response, why ? 当我取消选中该框时,其他2项应该消失了,但是在IE中没有响应,为什么?

Edit : 编辑:

Thanks to Huangism, I found the following message, and clicked it to allow access, now it works OK. 感谢Huangism,我找到了以下消息,并单击它允许访问,现在它可以正常工作了。

在此处输入图片说明

通过允许IE阻止内容解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么HTML复选框功能仅在IE中有效,而在Firefox或Chrome中不起作用? - Why html checkbox function only works in IE but not in Firefox or Chrome? 自定义复选框与Firefox / IE中的标准复选框重叠; 铬工作正常 - custom checkbox overlayed with standard checkbox in Firefox / IE; Chrome works fine PHP脚本和HTML - 这适用于Firefox和Chrome,但不适用于IE - PHP Script and HTML - This works in Firefox and Chrome, but not IE CSS Sprite代码可在Chrome和IE中使用,但不能在Firefox中使用? - CSS Sprite code works in Chrome and IE but not in Firefox? CSS代码可在Firefox和IE中使用,但不能在chrome中使用 - CSS code works in firefox and IE but not in chrome HTML和CSS在Chrome和Firefox中可以正常工作,但在IE7上却不能 - HTML and CSS works fine in Chrome and Firefox but not IE7 此代码可以在ie 10上正常运行,但不能在chrome和firefox上运行(javascript / ajax部分) - this code works fine on ie 10 but not on chrome and firefox (javascript/ajax portion) jquery 代码在 Firefox 和 Chrome 中有效,但在 IE11 中无效 - jquery code works in Firefox and Chrome but not in IE11 JS正则表达式代码不适用于Firefox,但适用于Chrome和IE - JS regex code doesn't work with firefox, but works on chrome and IE 自动溢出功能仅适用于Chrome。 为什么不在ie或Firefox中 - Overflow auto only works in chrome. Why not in ie or firefox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM