我已经花了好几个小时试图找出为什么codemirror.js不会在Firefox 之外的任何浏览器中加载。有什么想法吗?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title></title>
<script src="CodeMirror/js/codemirror.js"></script>
<link href="Styles/Style.css" rel="stylesheet" type="text/css" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function () { $('#container-1').tabs(); });
</script>
<style type="text/css"> /* (some css) */ </style>
</head><body>
<!-- (some stuff) -->
</body></html>
alert("LOL");
答案 0 :(得分:3)
我尝试了Firefox 3.6.3,Internet Explorer 8,Opera 10.53和Safari 4.0.5中的代码,它运行得很好。
请注意,脚本的地址是相对的,因此,如果您的网页位于www.mydomain.com/content/pages/page.html
,则会从www.mydomain.com/content/pages/CodeMirror/js/codemirror.js
加载脚本,而不是www.mydomain.com/CodeMirror/js/codemirror.js
。
您可以改进的一件事是将type
属性添加到代码中:
<script src="CodeMirror/js/codemirror.js" type="text/javascript"></script>