【发布时间】:2010-03-26 13:27:04
【问题描述】:
我正在用 html 编写这段代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript" type="text/javascript">
function setVisibility(id, visibility) {
document.getElementById(id).style.display = visibility;
}
</script>
<title>Welcome to the memory game</title>
</head>
<body>
<h1>Welcome to the memory game!</h1>
<input type="button" name="type" value='Show Layer' onclick="setVisibility('sub3', 'inline');"/>
<input type="button" name="type" value='Hide Layer' onclick="setVisibility('sub3', 'none');"/>
<div id="sub3">Message Box</div>
</body> </html>
它假设让“div”消失并重新出现,但它在 chrome 中工作而不是在资源管理器中。
任何人都知道如何使它在资源管理器中工作(我尝试在资源管理器中出现有关 activeX 的消息时允许被阻止的内容)?
谢谢,
格雷格
【问题讨论】:
-
这里一样,在 ie8 中工作得很好
-
Greg,你用的是哪个版本的IE?
-
您的示例非常简单,应该适用于任何地方。我可以让它不起作用的唯一方法是消除 IE8 给出的 ActiveX 警告(通过单击“x”图标),而不是明确允许被阻止的内容。
-
是的,对我有用。通常,您应该在点击“允许活动内容”按钮以从 IE 中的本地文件系统启用 JavaScript 后重新加载,就像在加载时运行的任何其他脚本一样(对于大多数避开内联事件处理程序属性的现代脚本而言, , 是不是全部)已经被屏蔽了。
标签: javascript internet-explorer html google-chrome