JS文件下载:/Files/yanghawk/calendar.TXT

 (下载完后请改成.js文件)

显示效果省略,用了就知道了。

1.使用的是js+Moss自带的WebService实现

2.日程保存在列表中.(字段栏:时间,标题。都是单行文本

不想多说了,代码如下:

前端页面引用这个JS文件,然后在页面中再添加如下JS代码

//取日历列表
    function GetCalendarListResult() {
        var soapEnv =
                "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                    <soapenv:Body> \
                        <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
            <listName>{CEE86AB6-FC0D-4CB3-9C8B-15D6AEA5692C}</listName> \
            <viewName /> \
            <query> \
        <Query> \
          <OrderBy> \
                                      <FieldRef Name='_x65f6__x95f4_' Ascending='FALSE'/>\

              忘记用E文,直接写了中文。表示:时间
                                   </OrderBy> \
                                </Query> \
       </query> \
            <viewFields> \
        <ViewFields> \
           <FieldRef Name='_x65f6__x95f4_' /> \
           <FieldRef Name='Title' /> \
        </ViewFields> \
       </viewFields> \
          <rowLimit>10000</rowLimit> \
          <queryOptions><QueryOptions /></queryOptions> \
          <webID /> \
         </GetListItems> \
                    </soapenv:Body> \
                 </soapenv:Envelope>";

        $.ajax({
            url: "/_vti_bin/lists.asmx",
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: CalendarResult,
            contentType: "text/xml; charset=\"utf-8\""
        });
    }
    function CalendarResult(xData, status) {
        var i, x = jQuery('rs\\:data', xData.responseXML).attr('ItemCount');
        var test = {};
        $("#data1").empty();
        //alert(jQuery('rs\\:data', xData.responseXML).attr('ItemCount'));           
        $(xData.responseXML).find("z\\:row").each(function () {
            test[$(this).attr("ows__x65f6__x95f4_")] = $(this).attr("ows_Title");
            i--;
        });
        $.getScript("http://****.com/calendar.js", function () {
            $calendar(0, 2010, 2012).show("cal", test);
        });
        return false;
    }

页面中别忘记增加,输出的DIV的ID了

<dl class="portal_model w230" style=" position:relative; z-index:2;">
  <dt style="margin-bottom: -6px;"><span class="dt_title">公司大事记</span></dt>
  <dd>
   <div id="cal" style="margin-left:5px; width:200px;"></div>
  </dd>
  </dl>

 

posted on 2011-11-04 10:45  volitation  阅读(451)  评论(0)    收藏  举报