Showing posts with label CQWP. Show all posts
Showing posts with label CQWP. Show all posts

Saturday, February 26, 2011

Display List In Content Query Webpart


 
    <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="/site/Lists/Calendar/Current%20Month%20Events.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("WebPartWPQ2") ;
            }
               else if(sourcelist.contentWindow)
                  // Internet Explorer
                  {
                displaylist = sourcelist.contentWindow.document.getElementById("WebPartWPQ2") ;
            }
               else if(sourcelist.document)
                  // Others?
                  {
                displaylist = sourcelist.document.getElementById("WebPartWPQ2") ;
            }
        }
        catch(err)
        {
            alert ("Loading failed");
        }
        var allDescendants = displaylist.getElementsByTagName("*");
        placeholder.innerHTML = displaylist.innerHTML;
    }
    </script>