在做日历时,需要用js(jquery)循环输出两周
<ul class="justList">
</ul>
<script type="text/javascript">
$(function(){
var d = new Date();
var dayCycle = d.getDay();
var weekday=new Array(7);
weekday[0]="周日";
weekday[1]="周一";
weekday[2]="周二";
weekday[3]="周三";
weekday[4]="周四";
weekday[5]="周五";
weekday[6]="周六";
for(var i=0;i<=weekday.length*2;i++){
var ul = $(".justList");
var li = $("<li></li>");
var textNode = weekday[i];
li.append(textNode);
ul.append(li);
}
})
</script>
但是这样效果是这样的:
![图片说明](https://img-ask.csdn.net/upload/201906/20/1560994064_564370.png)
只出来了一周。求大神指点:两周应该怎样循环输出!