通過當前日期求得本周開始和結束的日期
用java或在jsp頁面上解決﹗
<通過當前日期求得本周開始和結束的日期>
不需要通過button,eg:今天是2007-03-20
頁面上應顯示 时间段:2007-03-19 到 2007-03-25
------解决方案--------------------唉..... 妈妈说做好人要做到底
<html>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<head> <title> DateDamo </title>
</head>
<body>
<form method= "post " action= "ttt.jsp " name= "frmquery ">
<center>
<table border= "0 " width= "100% " height= "63 ">
<tr height= "31 ">
<td width= "14% " align= "middle "> Sun </td>
<td width= "14% " align= "middle "> Mon </td>
<td width= "14% " align= "middle "> Tue </td>
<td width= "14% " align= "middle "> Wen </td>
<td width= "14% " align= "middle "> Thu </td>
<td width= "15% " align= "middle "> Fri </td>
<td width= "15% " align= "middle "> Sat </td>
</tr>
<tr height= "32 ">
<td id= "h1 " align= "middle "> </td>
<td id= "h2 " align= "middle "> </td>
<td id= "h3 " align= "middle "> </td>
<td id= "h4 " align= "middle "> </td>
<td id= "h5 " align= "middle "> </td>
<td id= "h6 " align= "middle "> </td>
<td id= "h7 " align= "middle "> </td>
</tr>
</table>
</center>
</TABLE>
<INPUT type=button value=上周 width=20 onClick= "javascript:front(); ">
<INPUT type=button value=本周 width=20 onClick= "javascript:now(); ">
<INPUT type=button value=下周 width=20 onClick= "javascript:next(); ">
</form>
</body>
</HTML>
<script language=javascript>
var defaultFormat = "yyyy年MM月dd日 hh时mm分ss秒 ";//改成你想要的日期格式
var week;
function window.onload()
{
week = new Week();
now();
}
function front()
{
week.front();
document.getElementById( "h1 ").innerText = week.firstDay.Format(defaultFormat);
document.getElementById( "h7 ").innerText = week.firstDay.Format(defaultFormat);
}
function now()
{
week.now();
document.getElementById( "h1 ").innerText = week.firstDay.Format(defaultFormat);
document.getElementById( "h7 ").innerText = week.firstDay.Format(defaultFormat);
}
function next()
{
week.next();
document.getElementById( "h1 ").in