想做个类似google日历的东西,不过要比它简单很多
RT,功能不需要google那么强大,只要点击日历上的某个日期,就能显示那天有没有事情提醒,不需要像google那样精确到小时。我的后台是ssh2的,感觉比较难的是如何在jsp页面中嵌入日历框,原来试过在jsp页面顶上直接加JS代码,那么做日历是可以显示的,但点击的功能就让我犯难了啊。还是帖一些页面的代码吧,反正也是网上down的:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'yyh.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<style type="text/css">
<!--
a {text-decoration: none; font-family: "Webdings"; font-size:16px; color: #000000;}
-->
</style>
<script language="JavaScript">
var gYear, gMonth, gDay;
var days = [31,28,31,30,31,30,31,31,30,31,30,31];
function getDateStr(date){
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
return y+"-"+m+"-"+d;
}
function getDate(dateStr){
//alert(dateStr);
return new Date(dateStr);
}
function calendar(d){
var year = d.getFullYear();
var month = d.getMonth();
var day = d.getDate();
gYear = year;
gMonth = month+1;
gDay = day;
var rlt = "<table align=center cellspacing=1 border=0 cellspadding=2 bgcolor='#3399CC' width=500>";
// 月历的标题行。
rlt += "<tr title='双击回到当天'><td align=center bgcolor='#FFFF00' colspan=7 onDblClick='today()'>"
+ "<a href='javascript:prevYear()' title='上一年'> 7</a> "
+ "<a href='javascript:prevMonth()' title='上一月'>3</a> "
+ year + "年" + (month+1) + "月 "
+ "<a href='javascript:nextMonth()' title='下一月'>4</a> "
+ "<a href='javascript:nextYear()' title='下一年'>8</a></td></tr>";