【问题标题】:html file in CEWP only works in edit modeCEWP 中的 html 文件仅在编辑模式下有效
【发布时间】:2014-11-05 01:33:10
【问题描述】:

我在 SharePoint 2010 中使用 CEWP 通过内容链接链接到 HTML 文件,但是 jQuery 似乎只在页面处于编辑模式时运行。 HTML 正在显示,但没有显示通过 jQuery 创建的任何内容。注意事项:

  • 未选择“隐藏”Web 部件属性
  • 我的脚本链接包括“text='text/javascript'”
  • 完全相同的 HTML 文件在我的开发环境中工作,但不是测试
  • 网站的权限在开发和测试中是相同的
  • 在我将页面置于编辑模式之前,页面上的任何其他 Web 部件都无法正常工作,但是如果我删除有问题的 Web 部件,其他 Web 部件就会在编辑模式之外开始工作。

HTML文件代码是这样的:

<script type='text/javascript' src='/SiteAssets/jquery-1.6.2.min.js' ></script>

<style type="text/css">

#lineComment{
	width:10px;
	height:10px;
	padding-left: 3px;
}

	#tripReclose{
	float:left;
	margin-right:7px;	
}

#tripReclose th{
	padding-right:7px;
	text-align:left;
}

#tripReclose td, #openBreaker td{
	/*border-left:thin #E5E5E5 solid;
	border-right:thin #E5E5E5 solid;*/
	border-top:thin #E5E5E5 solid;
	border-bottom:thin #E5E5E5 solid;
}

#tripReclose caption{
	text-align:left;
	font-weight:bold;
	padding-top:5px;
	padding-bottom:5px;
}

#openBreaker{
	float:left;
}

#openBreaker th{
	padding-right:7px;
	text-align:left;
}


#openBreaker caption{
	text-align:left;
	font-weight:bold;
	padding-top:5px;
	padding-bottom:5px;	
}
</style>


<div id="lineStatus">
	<table id="tripReclose">
		<caption>Trip and Reclose Events</caption>
		<tbody>
			<tr>
				<th>Service Point</th><th>Event Date</th><th>Fault Target</th><th>Device jquery-1.6.2.minName</th>
			</tr>
		</tbody>
	</table>
	<table id="openBreaker">
		<caption>Open Breaker Events</caption>
		<tbody>
			<tr>
				<th>Service Point</th><th>Open Date</th><th>Close Date</th><th>Device Name</th><th>PLT Assigned</th>
			</tr>

		</tbody>
	</table>
	
</div>


<script type="text/javascript">

	/* Run custom JavaScript that retrieves list items via CAML - I cannot specify this code but can guarantee it works */  

</script>

【问题讨论】:

  • 您是否尝试过使用 IE Developer 工具(按 f12 并使用断点调试脚本)查看任何脚本错误?

标签: jquery sharepoint sharepoint-2010 cewp


【解决方案1】:

原来,另一个 Web 部件引用了一个不在站点资产文件夹中的 jquery 文件。我在根目录(它正在查找的位置)替换了该文件,问题已解决。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-06
    • 2019-10-25
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    • 2021-05-20
    • 2022-01-14
    • 1970-01-01
    相关资源
    最近更新 更多