一段js日历代码,看不懂,请大侠指点
<scriptlanguage="JavaScript"><!--n=0,s=0;tian=newArray(31,28,31,30,31,30,31,31,30,31,...
<script language="JavaScript">
<!--
n=0,s=0;
tian =new Array(31,28,31,30,31,30,31,31,30,31,30,31);
for(i=2005;i<2008;i++)
{
if(i%4==0) n=366;
else n=365;
s=s+n;
}
for(i=1;i<13;i++)
{
s=s+tian[i-1];
}
w=(s+6)%7;
content="<table><tr><td>日</td><td>一</td><td>二</td><td>三</td><td>四</td><td>五</td><td>六</td></tr>";
t=1;
for(i=0;i<42;i++)
{
if(i%7==0)
{
content=content+"<tr>";
}
if((i>=w)&&(i<(tian[m-1])+w))
{
content=content+"<td><a href=19-6.php?y="+y+"&m="+m+"&d="+t+">"+t+"</a></td>";
t++;
}
else
{
content=content+"<td> </td>";
}
if(i%7==6)
{
content=content+"</tr>";
}
}
content=content+"</table>";
//-->
</script>
----------------------------------
主要是这两条代码没看懂:w=(s+6)%7;和if((i>=w)&&(i<(tian[m-1])+w))
m是某个月份 展开
<!--
n=0,s=0;
tian =new Array(31,28,31,30,31,30,31,31,30,31,30,31);
for(i=2005;i<2008;i++)
{
if(i%4==0) n=366;
else n=365;
s=s+n;
}
for(i=1;i<13;i++)
{
s=s+tian[i-1];
}
w=(s+6)%7;
content="<table><tr><td>日</td><td>一</td><td>二</td><td>三</td><td>四</td><td>五</td><td>六</td></tr>";
t=1;
for(i=0;i<42;i++)
{
if(i%7==0)
{
content=content+"<tr>";
}
if((i>=w)&&(i<(tian[m-1])+w))
{
content=content+"<td><a href=19-6.php?y="+y+"&m="+m+"&d="+t+">"+t+"</a></td>";
t++;
}
else
{
content=content+"<td> </td>";
}
if(i%7==6)
{
content=content+"</tr>";
}
}
content=content+"</table>";
//-->
</script>
----------------------------------
主要是这两条代码没看懂:w=(s+6)%7;和if((i>=w)&&(i<(tian[m-1])+w))
m是某个月份 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询