js代码如下
//加载本月日历 var date1 = new Date(); var weekday=new Array(7); weekday[0]="星期日" ; weekday[1]="星期一"; weekday[2]="星期二"; weekday[3]="星期三"; weekday[4]="星期四"; weekday[5]="星期五"; weekday[6]="星期六"; var Tday=date1.getDate(); var sdate=Tday;//存储选择了哪一个日期 function MonthFDayW() { date1.setDate(1); var mf=date1.getDay(); if(mf==0){mf=7}// alert("本月第一天是 " + weekday[date.getDay()]); date1.setMonth(date1.getMonth() + 1); var lastDate = new Date(date1 - 3600000*24); var ml=lastDate.getDate(); for(var i=1;i<=ml;i++) { document.getElementById("cmCenter5_2_2").innerHTML +="<div class='cmCenter5_2_2_1' onmouseover='Rlomv($(this))' onmouseout='Rlomt($(this))' onclick='sRq($(this),"+i+")'><span>"+i+"</span><div class='cmCenter5_2_2_1_1'></div></div>"; } var mfMf=(mf-1)*33; $(".cmCenter5_2_2_1:eq(0)").css("margin-left",''+mfMf+'+px');// alert("本月最后一天是 " + lastDate.getDate()); }
//显示的Date function chushiDate(t) {// alert(t); var date = new Date();// Tday=date.getDate();// alert(Tday); var bMonth=date.getMonth()+1; $(".cmCenter5_1_1 span").html(bMonth); $(".cmCenter5_2_2_1").eq(sdate-1).css("color","#fffbea"); $(".cmCenter5_2_2_1_1").eq(sdate-1).css({"background-color":"#676767","width":"25px","height":"25px","left":"-1px","top":"-1px"}); var year=date.getFullYear(); var ymd=year + "-" + bMonth + "-" + t; $(".cmCenter5_1_2").html(ymd); date.setDate(t); $(".cmCenter5_1_3").html(weekday[date.getDay()]); }
window.onload=function(){fbl();tt();gg();MonthFDayW();chushiDate(Tday);}
我用alert弹出测试下了下,发现问题出在在调用函数chushiDate()传入参数Tday,在IE中无法传入。我纠结了!怎么会这样呢?
1 回答
www说
TA贡献1775条经验 获得超8个赞
(function () { var date = new Date(); var weekday = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); var Tday = date.getDate(); var s = Tday; var day = { chushiDate: function (t) { alert(t); } }; $(function () { day.chushiDate(Tday); }); })();
我写了个例子,Tday是可以传进来的,你再仔细检测检测你的代码。
添加回答
举报
0/150
提交
取消