【发布时间】:2017-10-04 10:21:30
【问题描述】:
我正在尝试构建一个简单的网页,根据用户点击“链接”来替换
以下代码完全符合我在 Chrome 和 Firefox 中的预期,但在 IE 10 或 11 中什么也不做(除了将链接转为访问的颜色):
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#activities").click(function(){
$("#body").load("test02.html");
});
});
</script>
</head>
<body>
<div id="header">
<a href="#" id="activities">Activities</a>
<!-- this stays the same -->
</div>
<div id="body">
<p>this is the content that arrives without needing prompting</p>
<!-- All content will be loaded here dynamically -->
</div>
<div id="footer">
<!-- this stays the same -->
</div>
</body>
</html>
这是“test02.html”的内容:
<p>---</p>
<p>Hello world!</p>
<p>---</p>
我检查了 IE 中的 javascript 安全设置,所有内容都设置为“启用”。我还尝试将 type="text/javascript" 添加到脚本标签。
一些谷歌搜索发现可能需要重新安装 IE,我已经尝试过了。
有人知道如何在 IE 中使用它吗?
【问题讨论】:
-
IE 控制台有错误吗?
-
我应该提到这是由我自己的 IIS 服务器在我网络上的另一台机器上运行的。
-
IE 控制台没有错误
-
@JohnCroc:我在 IE 控制台中出现错误,抱怨
addEventListener不存在。这是因为在 Intranet 上,IE 有一个非常愚蠢的默认设置,它告诉它自己蹒跚而行,假装自己不支持标准。你不明白吗?? -
@T.J.Crowder:请忽略我上面的评论。谢谢你。我的前几次尝试没有成功,但是当我将 放在 标签下,在任何其他标签之前,它现在可以工作了。
标签: javascript jquery html internet-explorer