我想在我的网页中添加一些javascript:
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="${contextPath}/js/jquery.ui.widget.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/blueimp-file-upload/9.5.2/jquery.iframe-transport.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/blueimp-file-upload/9.5.2/jquery.fileupload.min.js"></script>
但是,当我在开始标记<body>
之后尝试时,不会显示脚本标记之后的内容。
我也在标记</body>
结束之前尝试过,但是显示但是没有执行javascript。
Chrome不会产生任何错误
我使用JSP 2.0:
<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:form="http://www.springframework.org/tags/form"
version="2.0">
<jsp:directive.page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="false"/>
<jsp:output doctype-root-element="html" doctype-system="about:legacy-compat" />
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- ... -->
</html>
更新 它会生成短标记javascript,这似乎是浏览器的问题:
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"/>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"/><script type="text/javascript" src="/edalis/js/jquery.ui.widget.js"/>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/blueimp-file-upload/9.5.2/jquery.iframe-transport.min.js"/>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/blueimp-file-upload/9.5.2/jquery.fileupload.min.js"/>
<script type="text/javascript" src="/edalis/js/3dupload.js"/>
已修复我找到了一个避免自动标记关闭的解决方案,但它并不漂亮: - /
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js" type="text/javascript">/**/</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" type="text/javascript">/**/</script>
<script src="${contextPath}/js/jquery.ui.widget.js" type="text/javascript">/**/</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/blueimp-file-upload/9.5.2/jquery.iframe-transport.min.js" type="text/javascript">/**/</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/blueimp-file-upload/9.5.2/jquery.fileupload.min.js" type="text/javascript">/**/</script>
<script src="${contextPath}/js/3dupload.js" type="text/javascript">/**/</script>
答案 0 :(得分:0)
尝试将type="text/javascript"
添加到脚本标记中,也许JSP会尝试执行它们