码迷,mamicode.com
首页 > 其他好文 > 详细

TroubleShoot: SharePoint 2013: ExecuteOrDelayUntilScriptLoaded 页面发布后不执行的问题

时间:2014-11-04 17:18:01      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   color   ar   os   使用   java   

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"); }

bubuko.com,布布扣
<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>
View Code

 

Refer: http://msdn.microsoft.com/en-us/library/jj245759.aspx

TroubleShoot: SharePoint 2013: ExecuteOrDelayUntilScriptLoaded 页面发布后不执行的问题

标签:style   blog   http   io   color   ar   os   使用   java   

原文地址:http://www.cnblogs.com/windy2008/p/4074002.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!