0
我在SharePoint 2010中使用CEWP通过Content Link链接到HTML文件,但jQuery似乎只在页面处于编辑模式时才运行。 HTML正在显示,但没有显示通过jQuery创建的内容。注意事项:CEWP中的html文件仅适用于编辑模式
- “隐藏” Web部件属性不选择
- 我的脚本链接包括“文本=‘文/ JavaScript的’”
- 完全相同的HTML文件工作在我的开发环境,但不是测试
- 该网站的权限在开发和测试中是相同的
- 网页上的其他Web部件都没有工作,直到我将页面置于编辑模式,但是如果我删除了相关Web部件,其他Web部件在编辑模式之外开始工作。
HTML文件的代码是这样的:
<script type='text/javascript' src='/SiteAssets/jquery-1.6.2.min.js' ></script>
<style type="text/css">
#lineComment{
\t width:10px;
\t height:10px;
\t padding-left: 3px;
}
\t #tripReclose{
\t float:left;
\t margin-right:7px; \t
}
#tripReclose th{
\t padding-right:7px;
\t text-align:left;
}
#tripReclose td, #openBreaker td{
\t /*border-left:thin #E5E5E5 solid;
\t border-right:thin #E5E5E5 solid;*/
\t border-top:thin #E5E5E5 solid;
\t border-bottom:thin #E5E5E5 solid;
}
#tripReclose caption{
\t text-align:left;
\t font-weight:bold;
\t padding-top:5px;
\t padding-bottom:5px;
}
#openBreaker{
\t float:left;
}
#openBreaker th{
\t padding-right:7px;
\t text-align:left;
}
#openBreaker caption{
\t text-align:left;
\t font-weight:bold;
\t padding-top:5px;
\t padding-bottom:5px; \t
}
</style>
<div id="lineStatus">
\t <table id="tripReclose">
\t \t <caption>Trip and Reclose Events</caption>
\t \t <tbody>
\t \t \t <tr>
\t \t \t \t <th>Service Point</th><th>Event Date</th><th>Fault Target</th><th>Device jquery-1.6.2.minName</th>
\t \t \t </tr>
\t \t </tbody>
\t </table>
\t <table id="openBreaker">
\t \t <caption>Open Breaker Events</caption>
\t \t <tbody>
\t \t \t <tr>
\t \t \t \t <th>Service Point</th><th>Open Date</th><th>Close Date</th><th>Device Name</th><th>PLT Assigned</th>
\t \t \t </tr>
\t \t </tbody>
\t </table>
\t
</div>
<script type="text/javascript">
\t /* Run custom JavaScript that retrieves list items via CAML - I cannot specify this code but can guarantee it works */
</script>
您是否尝试过使用IE Developer工具(按f12和带断点调试脚本)查看任何脚本错误? – Godwin 2014-11-04 15:18:29