' htm+= daycount+'' daycount++; } htm+='' } $("#cal_calendar").append(htm); var d=''; if(month<10){ d = year+'-0'+month }else{ d = year+'-'+month } //获取本月的文章 getNewsOfMonth(d); return d; } $(function(){ //加载日期 var date = showday() }) var newsObj={} function getNewsOfMonth(theDate){ $.ajax({ url : "/system/resource/newsdata/getCalendarData.jsp", type: "post", data:{theDate:theDate,"owner":1567534606,"hdwzlm":"1011,1036","method":"getAllOfMonthByMap"}, dataType : "json", contentType : "application/x-www-form-urlencoded; charset=UTF-8", success : function(data) { if(data&&{}!=data){ for(var pr in data){ $("#"+pr).addClass('on'); var doms = $($("#news-tpl").html()); doms.attr('data-value',pr); doms.attr('id','news_show'); var newListHmtl ='' var array=data[pr]; for(var j=0;j<2;j++){ var news=array[j]; if(!news) break; newListHmtl+= '
  • '+ '
    '+news.title+'
    ' +news.wbdate+'

    '+news.address+'

    '+ '
  • ' } doms.find("ul").append(newListHmtl); doms.find('.ssrc_more a').attr("href","calendarmore.jsp?urltype=tree.TreeTempUrl&wbtreeid=1011&hdwzlmd=1011,1036&dqri="+ pr); doms.css("display","block"); newsObj[pr]=doms; console.log(" currendDateStr :"+currendDateStr); console.log(" pr :"+pr); if(currendDateStr==pr){ $("#calendar_content").append(doms); } $('td.on').hover(function(){ var text = $(this).attr('data-value'); var pr = $("#news_show").attr('data-value'); if(text!=pr){ $("#news_show").remove(); var doms=newsObj[text] $("#calendar_content").append(doms); } }) } } }, error: function(XMLHttpRequest, textStatus, errorThrown) { } }) }