“jQuery”导入 simplemodal 时未定义
这只发生在 IE6 中。使用以下代码,我收到错误 'jQuery' is not Define on line 9 char 1。当我删除 simplemodal 行时,没有错误。我尝试设置 type="text/javascript" charset="utf-8" 但它仍然不起作用。有什么想法吗?
<html>
<head>
<script language="Javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script language="Javascript" src="scripts/jquery.simplemodal.1.4.1.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined'){
document.write(unescape("%3Cscript type='text/javascript' charset='utf-8' src='scripts/jquery-1.4.4.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
</head>
<body>
test
</body>
</html>
This only happens in IE6. With the following code I get the error 'jQuery' is not defined on line 9 char 1. There is no error when I remove the simplemodal line. I tried setting type="text/javascript" charset="utf-8" but it still didn't work. Any ideas?
<html>
<head>
<script language="Javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script language="Javascript" src="scripts/jquery.simplemodal.1.4.1.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined'){
document.write(unescape("%3Cscript type='text/javascript' charset='utf-8' src='scripts/jquery-1.4.4.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
</head>
<body>
test
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你写 type="application/javascript" IE 不会读取标签内的代码。你必须使用文本/javascript
if you write type="application/javascript" IE doesnt read the code inside the tag. You have to use text/javascript
尝试更改
为
Try changing
to
将 SimpleModal 的加载移至未定义检查之后。
Move the loading of SimpleModal to after your undefined check.