标签:var fun func bre new div 格式化 cti inner
<div id="mDayWeek">9月29日 星期五</div>
<script>
week(‘mDayWeek‘);
//几月几号+星期几
function week(id) {
var obj = window.document.getElementById(id);
var date = new Date();
var month = date.getMonth()+1;//月
var day = date.getDate();//日
var data = date.getDay();//星期几
switch(data){
case 0:
weeks="星期日";
break;
case 1:
weeks="星期一";
break;
case 2:
weeks="星期二";
break;
case 3:
weeks="星期三";
break;
case 4:
weeks="星期四";
break;
case 5:
weeks="星期五";
break;
case 6:
weeks="星期六";
break;
}
obj.innerHTML= month + ‘月‘ + day + ‘日‘ + ‘ ‘ + weeks;
}
</script>
标签:var fun func bre new div 格式化 cti inner
原文地址:http://www.cnblogs.com/opcec/p/7649945.html