我有一个 SharePoint 2010 网页,我正在构建一个简单的 SharePoint 列表。这个想法是有一个自动构建前半部分共享点页面的列表。该页面在 FF 和 Chrome 中呈现良好,但在 IE 中没有。它永远不会将列表的内容加载到所需的 div 中。几乎就像代码没有触发一样。谢谢您的帮助!
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$().SPServices({
operation: "GetListItems",
async: false,
listName: "HomepageControl",
CAMLViewFields: "<ViewFields><FieldRef Name='Item1link' /><FieldRef Name='Item2link' /><FieldRef Name='Item3link' /><FieldRef Name='Item4link' /><FieldRef Name='Item1image' /><FieldRef Name='Item2image' /><FieldRef Name='Item3image' /><FieldRef Name='Item4image' /><FieldRef Name='FeatureEnabled' /><FieldRef Name='WelcomeMessage' /><FieldRef Name='PageHeading' /></ViewFields>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
var newhtml = "<div id='contentheaderbar'>" + $(this).attr("ows_PageHeading") + "</div>" + "<div id='dasheddividerbin'><img width='2' height='5' src='/sites/corpcomm/SiteAssets/TemplateTest/images/fill.gif' border='0'/></div>" + "<div class='whitebg' id='innercontentbin' style='text-align: right; '>" +
"<div id='WelcomeBin'>" + $(this).attr("ows_WelcomeMessage") + "</div>" + "<div id='FeaturedBin'><h2>Featured Links:</h2><ul>" + "<li><a href='" + $(this).attr("ows_Item1link") + "' target='_blank'><img width='166' height='106' src='" + $(this).attr("ows_Item1image") + "' border='0'/></a></li>" + "<li><a href='" + $(this).attr("ows_Item2link") + "' target='_blank'><img width='166' height='106' src='" + $(this).attr("ows_Item2image") + "' border='0'/></a></li>" + "<li><a href='" + $(this).attr("ows_Item3link") + "' target='_blank'><img width='166' height='106' src='" + $(this).attr("ows_Item3image") + "' border='0'/></a></li>" + "<li><a href='" + $(this).attr("ows_Item4link") + "' target='_blank'><img width='166' height='106' src='" + $(this).attr("ows_Item4image") + "' border='0'/></a></li>" + "</ul><div class='clear'></div></div><div class='clear'></div></div></div>" + "<div id='dasheddividerbin'><img width='2' height='5' src='/sites/corpcomm/SiteAssets/TemplateTest/images/fill.gif' border='0'></div>"
$('#maindiv').append(newhtml);
});
}
});
});
</script>
<div id="maindiv"></div>