⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calendar.jsp

📁 采用j2ee架构做的bbs
💻 JSP
字号:
<%@page pageEncoding="gb2312"%>
<%@page contentType="text/html;charset=gb2312" %>
<%@ page language="java" import="java.util.*"%>
<%!String days[];
%>
<html>
	<head>
		<style>
				a{text-decoration:none}a.xh{text-decoration:none; color:#ffffff}a:hover.xh{text-decoration:underline}a.zh{text-decoration:none;color:#000000}a:hover.zh{text-decoration:underline;color:blue}
				body,td{font-size:9pt}
		</style>
	</head>
	<body topmargin="0" style="text-align: center">
		<table width="984" height="287" border="1">
  <tr>
    <td width="216" height="281"><img src="images/skin/Pixel076.gif" width="215" height="266"></td>
    <td width="559"><form>
      <%days = new String[42];
			for (int i = 0; i < 42; i++) {
				days[i] = "";
			}

			%>
      <%GregorianCalendar currentDay = new GregorianCalendar();
			int today = currentDay.get(Calendar.DAY_OF_MONTH);
			int month = currentDay.get(Calendar.MONTH);
			int year = currentDay.get(Calendar.YEAR);
		
			
			out.println(year + " 年" + (month + 1) + " 月" + today + " 日  ");
			Calendar thisMonth = Calendar.getInstance();
			thisMonth.set(Calendar.MONTH, month);
			thisMonth.set(Calendar.YEAR, year);
			thisMonth.setFirstDayOfWeek(Calendar.SUNDAY);
			thisMonth.set(Calendar.DAY_OF_MONTH, 1);
			int firstIndex = thisMonth.get(Calendar.DAY_OF_WEEK) - 1;
			int maxIndex = thisMonth.getActualMaximum(Calendar.DAY_OF_MONTH);
			for (int i = 0; i < maxIndex; i++) {
				days[firstIndex + i] = String.valueOf(i + 1);
			}

			%>
      <table border="0" height="81">
        <div align=center>
          <tr>
            <th width="70" height="25"><font color="red">日</font></th>
            <th width="70" height="25">一</th>
            <th width="70" height="25">二</th>
            <th width="70" height="25">三</th>
            <th width="70" height="25">四</th>
            <th width="70" height="25">五</th>
            <th width="70" height="25"><font color="red">六</font></th>
          </tr>
          <%for (int j = 0; j < 6; j++) {

				%>
          <tr>
            <%for (int i = j * 7; i < (j + 1) * 7; i++) {

					%>
            <td width="66" height="16" valign="middle" align="center"><%if ((i - firstIndex + 1) == today) {

						%>
                <font color="red"><%=days[i]%></font>
                <%} else {

						%>
                <%=days[i]%>
                <%}

				%>
            </td>
            <%}

			%>
          </tr>
          <%}

		%>
        </div>
      </table>
    </form></td>
    <td width="187"><img src="images/skin/mouse34.gif" width="192" height="269"></td>
  </tr>
</table>
<div id=Clock align=center style="font-family: Verdana; font-size: 60; color:#0000FF">&nbsp;</div>

<script>
<!--
function tick() {
  var hours, minutes, seconds, ap;
  var intHours, intMinutes, intSeconds;
  var today;

  today = new Date();

  intHours = today.getHours();
  intMinutes = today.getMinutes();
  intSeconds = today.getSeconds();

  if (intHours == 0) {
     hours = "12:";
     ap = "Midnight";
  } else if (intHours < 12) { 
     hours = intHours+":";
     ap = "A.M.";
  } else if (intHours == 12) {
     hours = "12:";
     ap = "Noon";
  } else {
     intHours = intHours - 12
     hours = intHours + ":";
     ap = "P.M.";
  }

  if (intMinutes < 10) {
     minutes = "0"+intMinutes+":";
  } else {
     minutes = intMinutes+":";
  }

  if (intSeconds < 10) {
     seconds = "0"+intSeconds+" ";
  } else {
     seconds = intSeconds+" ";
  } 

  timeString = hours+minutes+seconds+ap;

  Clock.innerHTML = timeString;

  window.setTimeout("tick();", 100);
}

window.onload = tick;
-->
</script>
	</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -