📄 iecalendar.jsp
字号:
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page import="java.util.Calendar" %>
<%@ page import="java.util.GregorianCalendar" %>
<%@ page import="java.util.Date" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="images/style.css" type="text/css">
<title>
IECalendar
</title>
<script language="JavaScript" >
var daystr="1";
function selectdate()
{
document.all.calendar.submit();
}
function premonth()
{
if(parseInt(document.all.month.value)==1)
{
window.location="IECalendar.jsp?year="+document.all.year.value+"&month=12";
}
else
{
window.location="IECalendar.jsp?year="+document.all.year.value+"&month="+(parseInt(document.all.month.value)-1)%12;
}
}
function nextmonth()
{
if(parseInt(document.all.month.value)==11)
{
window.location="IECalendar.jsp?year="+document.all.year.value+"&month=12";
}
else
{
window.location="IECalendar.jsp?year="+document.all.year.value+"&month="+(parseInt(document.all.month.value)+1)%12;
}
}
function preyear()
{
if(parseInt(document.all.year.value)==1970)
{
return;
}
else
{
window.location="IECalendar.jsp?year="+(parseInt(document.all.year.value)-1)+"&month="+parseInt(document.all.month.value);
}
}
function nextyear()
{
if(parseInt(document.all.year.value)==2470)
{
return;
}
else
{
window.location="IECalendar.jsp?year="+(parseInt(document.all.year.value)+1)+"&month="+parseInt(document.all.month.value);
}
}
function getday()
{
return daystr;
}
</script>
</head>
<%
int year=0;
int month=0;
int day=1;
Date now=new Date();
Calendar calendar=new GregorianCalendar();
calendar.setTime(now);
if((request.getParameter("year")!=null))
{
if((!request.getParameter("year").equals(""))||(!request.getParameter("year").trim().equals("")))
{
year=Integer.parseInt(request.getParameter("year"));
}
else
{
year=calendar.get(calendar.YEAR);
}
}
else
{
year=calendar.get(calendar.YEAR);
}
if((request.getParameter("month")!=null))
{
if((!request.getParameter("month").equals(""))||(!request.getParameter("month").trim().equals("")))
{
month=Integer.parseInt(request.getParameter("month"));
}
else
{
month=Integer.parseInt(request.getParameter("month"));
}
}
else
{
month=calendar.get(calendar.MONTH)+1;
}
// if((request.getParameter("day")!=null))
// {
// if((!request.getParameter("day").equals(""))||(!request.getParameter("day").trim().equals("")))
// {
// day=Integer.parseInt(request.getParameter("day"));
// }
// else
// {
// day=Integer.parseInt(request.getParameter("day"));
// }
// }
// else
// {
// day=calendar.get(calendar.DAY_OF_MONTH);
// }
%>
<body topmargin="5">
<center>
<form action="" name="calendar">
<table border="1" width="450" cellspacing="0" cellpadding="1" bordercolordark="#FFFFFF" bordercolorlight="#000000" style="font-size: 12px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 0px">
<tr bgcolor="#9370DB">
<td width="100"><font color="#F0F8FF" size="3"> <b>月 份</b> </font></td>
<td>
<select name="month" style="width:125" onchange="document.all.calendar.submit();">
<%
for(int i=1;i<=12;i++)
{
%>
<option value="<%=i%>" <%if(i==month){out.print(" selected");}%>><%=i%>月</option>
<%
}
%>
</select>
</td>
<td width="100"><font color="#F0F8FF" size="3"> <b>年 份</b> </font></td>
<td>
<select name="year" style="width:125" onchange="document.all.calendar.submit();">
<%
for(int i=0;i<=500;i++)
{
%>
<option value="<%=i+1970%>" <%if(i==year-1970){out.print(" selected");}%>><%=i+1970%>年</option>
<%
}
%>
</select>
</td>
</tr>
</table>
<table border="0" width="450" cellspacing="0" cellpadding="1" bordercolordark="#FFFFFF" bordercolorlight="#000000" style="font-size: 12px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-width: 0px">
<tr>
<td>
<br><img src="images/preyear.gif" style="cursor:hand"
onclick="if(parseInt(document.all.year.value)==1970)
{
return;
}
else
{
window.location='IECalendar.jsp?year='+(parseInt(document.all.year.value)-1)+'&month='+parseInt(document.all.month.value);
}">
<img src="images/premonth.gif" style="cursor:hand"
onclick="if(parseInt(document.all.month.value)==1)
{
window.location='IECalendar.jsp?year='+document.all.year.value+'&month=12';
}
else
{
window.location='IECalendar.jsp?year='+document.all.year.value+'&month='+(parseInt(document.all.month.value)-1)%12;
}">
<img src="images/today.gif" style="cursor:hand" onclick="window.location='IECalendar.jsp';">
<img src="images/nextmonth.gif" style="cursor:hand"
onclick="if(parseInt(document.all.month.value)==11)
{
window.location='IECalendar.jsp?year='+document.all.year.value+'&month=12';
}
else
{
window.location='IECalendar.jsp?year='+document.all.year.value+'&month='+(parseInt(document.all.month.value)+1)%12;
}">
<img src="images/nextyear.gif" style="cursor:hand"
onclick="if(parseInt(document.all.year.value)==2470)
{
return;
}
else
{
window.location='IECalendar.jsp?year='+(parseInt(document.all.year.value)+1)+'&month='+parseInt(document.all.month.value);
}"></td>
</tr>
</table>
<br>
<table border="1" width="450" cellpadding="1" cellspacing="0" bordercolordark="#FFFFFF" cellspacing="0" cellpadding="0" bordercolorlight="#000000" style="font-size: 12px; border-left-width: 1px; border-right-width: 1px; border-top-width: 2px; border-bottom-width: 0px">
<tr bgcolor="#B0C4DE">
<td><font color="gold"><b> 星期日 </b></font></td>
<td><b> 星期一 </b></td>
<td><b> 星期二 </b></td>
<td><b> 星期三 </b></td>
<td><b> 星期四 </b></td>
<td><b> 星期五 </b></td>
<td><font color="gold"><b> 星期六 </b></font></td>
</tr>
<%
int days[]=new int[50];
for(int i=0;i<50;i++)
{
days[i]=0;
}
Calendar myCalendar=new GregorianCalendar();
myCalendar.set(year,month-1,day);
for(int i=1;i<=myCalendar.getActualMaximum(myCalendar.DAY_OF_MONTH);i++)
{
days[myCalendar.get(myCalendar.DAY_OF_WEEK)+i-1]=i;
}
for(int i=0;i<6;i++)
{
%>
<tr bgcolor="#00FA9A">
<%
for(int j=1;j<=7;j++)
{
if(days[i*7+j]==0)
{
%>
<td> </td>
<%
}
else
{
%>
<td><a href="javascript:parent.opener.myGetDate(document.all.year.value+'-'+document.all.month.value+'-'+<%=days[i*7+j]%>);window.close();" style="text-decoration:none">
<font size="3" <%if(days[i*7+j]==calendar.get(calendar.DATE)){out.println("color=\"red\" ");}else{out.println("color=\"blue\" ");}%>>
<b onMouseOver="this.style.color='BLACK';" onMouseOut="<%if(days[i*7+j]==calendar.get(calendar.DATE)){out.print("this.style.color='red'");}else{out.print("this.style.color='blue'");}%>"><%=days[i*7+j]%></b></font></a></td>
<%
}
}
%>
</tr>
<%
}
%>
</table>
</form>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -