Alf*_*avo 8 javascript jquery jsp jspx
我正在Eclipse中创建一个动态Web项目(几乎从头开始),我创建了一个JSPX文件
<head>...
<script type="text/javascript" src="route/to/scripts/jquery.js"></script>
<script type="text/javascript" src="route/to/scripts/jquery.ui.js"></script>
<script type="text/javascript" src="route/to/scripts/something.js"></script>
</head>
Run Code Online (Sandbox Code Playgroud)
我打算使用Jquery UI进行排序,我发现使用JSPX时,只有第一个脚本在Firefox和IE中加载(而在Opera中它可以工作......).如果我使用普通的JSP,无论是HTML的XHTML,它都会加载所有的JS文件.
有没有办法在不使用的情况下成功包含所有JS文件
<script>
<jsp:include ...>
</script>
Run Code Online (Sandbox Code Playgroud)
我必须知道吗?(因为这个加载脚本INTO到最后的(X)HTML)
编辑:只是想...为什么Opera在读取<script>标签时FF和IE失败时读取了xhtml ?它可能是一个错误吗?
Bal*_*usC 11
JSPX具有古怪的行为,它可以自动折叠没有正文的标签.如此有效
<script type="text/javascript" src="route/to/scripts/jquery.js"></script>
<script type="text/javascript" src="route/to/scripts/jquery.ui.js"></script>
<script type="text/javascript" src="route/to/scripts/something.js"></script>
Run Code Online (Sandbox Code Playgroud)
将最终在浏览器中
<script type="text/javascript" src="route/to/scripts/jquery.js" />
<script type="text/javascript" src="route/to/scripts/jquery.ui.js" />
<script type="text/javascript" src="route/to/scripts/something.js" />
Run Code Online (Sandbox Code Playgroud)
这是无效的<script>语法(在浏览器中右键单击页面并执行查看源自己查看).浏览器行为未确定.
您可以通过<jsp:text />在标记之间放置来解决此问题
<script type="text/javascript" src="route/to/scripts/jquery.js"><jsp:text /></script>
<script type="text/javascript" src="route/to/scripts/jquery.ui.js"><jsp:text /></script>
<script type="text/javascript" src="route/to/scripts/something.js"><jsp:text /></script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4958 次 |
| 最近记录: |