2014-11-03 88 views
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>

+0

您是否嘗試過使用IE Developer工具(按f12和帶斷點調試腳本)查看任何腳本錯誤? – Godwin 2014-11-04 15:18:29

回答

0

原來,另一個Web部件被引用,這不是在站點文件夾資產jQuery的文件。我在根目錄(它正在查找的位置)替換該文件,問題已解決。