首页 > 代码库 > TroubleShoot: SharePoint 2013: ExecuteOrDelayUntilScriptLoaded 页面发布后不执行的问题
TroubleShoot: SharePoint 2013: ExecuteOrDelayUntilScriptLoaded 页面发布后不执行的问题
SharePoint 2010 中的ExecuteOrDelayUntilScriptLoaded,在2013 中使用时没有效果的问题。
Example:
SharePoint 2013 Code:
SP.SOD.executeFunc(‘sp.js‘, ‘SP.ClientContext‘, sharePointReady);
function sharePointReady() { alert("Ready"); }
SharePoint 2010 Code:
ExecuteOrDelayUntilScriptLoaded(sharePointReady, "sp.js");
function sharePointReady() { alert("Ready"); }
<script type="text/javascript">ExecuteOrDelayUntilScriptLoaded(GetIdeaItemCount,"sp.js");var list;function GetIdeaItemCount(){var context = new SP.ClientContext.get_current();var web = context.get_web();list = web.get_lists().getByTitle(‘TestFormLib‘);context.load(list);context.executeQueryAsync(Function.createDelegate(this, this.GetSuccess), Function.createDelegate(this, this.GetFailed));}function GetSuccess(){ document.getElementById("spListItemCount").innerText=list.get_itemCount();}function GetFailed(sender,args){ alert(‘failed. Message:‘ + args.get_message()); }</script>
Refer: http://msdn.microsoft.com/en-us/library/jj245759.aspx
TroubleShoot: SharePoint 2013: ExecuteOrDelayUntilScriptLoaded 页面发布后不执行的问题
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。