[英]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.