display SharePoint list from another site

display SharePoint list from another site

from: How to display SharePoint list from another site | WebGuru’s Blog about Digital Life

DIV id=”ListPlaceholder”><IMG src=”/_layouts/images/GEARS_AN.GIF”></DIV>

<!– Paste the URL of the source list below: –>
<iframe id=”SourceList” style=”display:none;”
src=”http://domain.com/SiteCollection/SourceSite/SourceList/MyView.aspx”
onload=”DisplayThisList()”></iframe>

<script type=”text/javascript”>
function DisplayThisList()
{
var placeholder = document.getElementById(“ListPlaceholder”);

var displaylist = null;
var sourcelist = document.getElementById(“SourceList”);

try {
if(sourcelist.contentDocument)
// Firefox, Opera

{displaylist = sourcelist.contentDocument.getElementById(“WebPartWPQ1”) ;}
else if(sourcelist.contentWindow)
// Internet Explorer

{displaylist = sourcelist.contentWindow.document.getElementById(“WebPartWPQ1”) ;}
else if(sourcelist.document)
// Others?

{displaylist = sourcelist.document.getElementById(“WebPartWPQ1”) ;}
}
catch(err) { alert (“Loading failed”);}

displaylist.removeChild(displaylist.getElementsByTagName(“table”)[0]);
var allDescendants = displaylist.getElementsByTagName(“*”);
for (i=0;i<allDescendants.length;i++) {
allDescendants[i].removeAttribute(“id”);
allDescendants[i].removeAttribute(“onclick”);
allDescendants[i].removeAttribute(“onfocus”);
allDescendants[i].removeAttribute(“onmouseover”);
}
placeholder.innerHTML = displaylist.innerHTML;
}
</script