if($iv==date("d") && date("n")==$pmonth && date("Y")==$pyear){ 63 print( "<td align=center bgcolor=ffaaaa><a href='#' target=_blank>".$iv."</a></td>" ); 64 }else{ 65 print( "<td align=center><a href='#' target=_blank>".$iv."</a></td>" ); 66 } 67 }else{ 68 print( "<td> </td>" ); 69 } 70 71 //如果能被7整除(每行显示7个)则输出一个换行 72 if ($i%7 ==0) { 73 print( "</tr><tr align=center bgcolor=ffffff height=19>" ); 74 } 75 } 76?> 77</tr> 78</table> 79</body> 80</html>
具体实现效果如下:

下面是根据上述算法和逻辑在NoahWeb中的具体实现代码:
1 <% @ Page language="c#" AutoEventWireup="false" Inherits="NoahWeb.Engine" %> 2 <style> 3 td { }{ font-family: "宋体"; font-size:9pt} 4 </style> 5 <!-- NoahComment 以下为NoahWeb表现层通过该日历算法实现的具体代码 --> 6 7 <!-- NoahComment 先判断是否指定了一个年份和月份,没有则根据当前的年和月份显示 --> 8 <!-- NoahIf EX="[_root.ReqDate]==[null]" --> 9 <!-- NoahSetValue SetName="CurrentDate" SetValue="date('O',mktime())" --> 10 <!-- NoahElse --> 11 <!-- NoahSetValue SetName="CurrentDate" SetValue="[_root.ReqDate]" --> 12 <!-- NoahEndIf --> 13 14 <!-- NoahSetValue SetName="pyear" SetValue="date('Y',mktime([CurrentDate]))" --> 15 <!-- NoahSetValue SetName="pmonth" SetValue="date('n',mktime([CurrentDate]))" --> 16 17 <!-- NoahComment 以下的代码生成日历显示的表格头内容 --> 18 上一页 [1] [2] [3] [4] [5] 下一页 |