Jquery plugins 带有SharePoint的JQuery循环插件代码
我正在尝试复制SharePoint 2010中的功能。我添加了“内容编辑器”web部件并修改了源html。然而,我没有得到期望的结果,这是我在代码中缺少的。我的输出有点像 这是我的密码Jquery plugins 带有SharePoint的JQuery循环插件代码,jquery-plugins,sharepoint-2010,Jquery Plugins,Sharepoint 2010,我正在尝试复制SharePoint 2010中的功能。我添加了“内容编辑器”web部件并修改了源html。然而,我没有得到期望的结果,这是我在代码中缺少的。我的输出有点像 这是我的密码 <IMG ID="slideshowPicturePlaceholder" src="/_layouts/images/GEARS_AN.GIF" style="display:none"/> <center><div id="slideshowContentArea" s
<IMG ID="slideshowPicturePlaceholder" src="/_layouts/images/GEARS_AN.GIF" style="display:none"/>
<center><div id="slideshowContentArea" style="display:none"> </div></center>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://malsup.github.com/chili-1.7.pack.js"></script>
<script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.2.72.js"></script>
<script>
function GetAllImages()
{
$("#slideshowPicturePlaceholder").css("display", "block");
var soapEnv = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body><GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>";
//The name of the image library is called 'SlideShow'. Replace the name bewlo with the name of your image library
soapEnv += "<listName>SlideShow</listName>";
soapEnv += "<query><Query><OrderBy Override='TRUE'><FieldRef Name='Created' Ascending='FALSE' /></OrderBy></Query></query>";
soapEnv += "<viewFields><ViewFields><FieldRef Name='Title'/><FieldRef Name='ows_FileLeafRef'/></ViewFields></viewFields><rowLimit></rowLimit>";
soapEnv += "</GetListItems></soapenv:Body></soapenv:Envelope>";
var port = window.location.port;
if (port.length <= 0)
port = "";
else
port = ":"+port;
var webservice = window.location.protocol+"//"+window.location.hostname+port+L_Menu_BaseUrl+"/_vti_bin/lists.asmx";
$.ajax({
url: webservice,
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processQueryResults,
contentType: "text/xml; charset=utf-8",
error: function(xhr) {
alert('Error! Status = ' + xhr.status);}
});
}
function processQueryResults(xData, status)
{
var port = window.location.port;
if (port.length <= 0)
port = "";
else
port = ":"+port;
//Change the below to point to your image library
var imageURL = window.location.protocol+"//"+window.location.hostname+port+L_Menu_BaseUrl+"/SlideShow/";
var itemURL = window.location.protocol+"//"+window.location.hostname+port+L_Menu_BaseUrl+"/SlideShow/Forms/DispForm.aspx?ID=";
$("#slideshowContentArea").html("")
$("#slideshowContentArea").html("<table cellspacing='20'><tr><td>")
$("#slideshowContentArea").html("<div class='nav'><a id='prev href='#'>Prev</a><a id='next' href='#'>Next</a></div>")
$(xData.responseXML).find("z\\:row").each(function() {
var title = $(this).attr("ows_Title");
var imageLink = imageURL+$(this).attr("ows_FileLeafRef").substring($(this).attr("ows_FileLeafRef").indexOf('#')+1);
var itemLink = itemURL+$(this).attr("ows_ID");
var Html ="<div style='padding: 10px;border:1px solid #ccc;background-color:#eee;width:270px;height: 270px;top:0;left: 0;'><a target='_blank' border='0' href='"+itemLink+"'><img width='250' height='250' src='"+ imageLink +"'/></a><p align='center'></p></div><pre><code>$('#slideshow').cycle({fx:'scrollHorz',prev:'#prev',next:'#next',after:onAfter,timeout:0});</code></pre></td></tr></table>";
$("#slideshowContentArea").append(Html);
});
$("#slideshowPicturePlaceholder").css("display", "none");
$("#slideshowContentArea").css("display", "block");
}
GetAllImages();
</script>
";
$(“#slideshowContentArea”).append(Html);
});
$(“#slideshowPicturePlaceholder”).css(“显示”、“无”);
$(“#slideshowContentArea”).css(“显示”、“块”);
}
GetAllImages();
我在哪里失踪了?试试这个:
$(xData.responseXML).find("[nodeName=z:row]").each(function() {
函数GetAllImages()
{
$(“#slideshowPicturePlaceholder”).css(“显示”、“块”);
var soapEnv=“”;
//图像库的名称称为“幻灯片放映”。请将名称bewlo替换为图像库的名称
soapEnv+=“幻灯片放映”;
soapEnv+=“”;
soapEnv+=“”;
soapEnv+=“”;
var port=window.location.port;
如果(port.length还要注意,带有find(“z\\:row”)
方法的行在Safari和Chrome浏览器中不起作用。您应该将其更改为:
希望这对其他人有所帮助;我们花了一些时间来解决它!$(xData.responseXML)。查找(“[nodeName='z:row']”)。每个(函数(i){
$(xData.responseXML).find("[nodeName=z:row]").each(function() {