js: var months = new Array("一", "二", "三","四", "五", "六", "七", "八", "九","十", "十一", "十二"); var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31); var days = new Array("星期日","星期一", "星期二", "星期三","星期四", "星期五", "星期六"); var classTemp; var today=new getToday(); var year=today.year; var month=today.month; var newCal; function getDays(month, year) { if (1 == month) return ((0 == year % 4) && (0 != (year % 100))) ||(0 == year % 400) ? 29 : 28; else return daysInMonth[month]; } function getToday() { this.now = new Date(); this.year = this.now.getFullYear(); this.month = this.now.getMonth(); this.day = this.now.getDate(); } function Calendar() { var dates=document.getElementById("dates").value;//计划日期 var num=document.getElementById("num").value;//计划数 var price=document.getElementById("price").value;//价格 //--处理行程的变量 var dat; var yead;//年 var md;//月 var datd;//日 var money;// 价格 var peple;//计划数 //--处理行程的变量 newCal = new Date(year,month,1); today = new getToday(); var day = -1; var startDay = newCal.getDay(); var endDay=getDays(newCal.getMonth(), newCal.getFullYear()); var daily = 0; if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth())) { day = today.day; } var caltable = document.all.caltable.tBodies.calendar; var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear()); for (var intWeek = 0; intWeek < caltable.rows.length;intWeek++) for (var intDay = 0;intDay < caltable.rows[intWeek].cells.length;intDay++) { var cell = caltable.rows[intWeek].cells[intDay]; var montemp=(newCal.getMonth()+1)<10?("0"+(newCal.getMonth()+1)):(newCal.getMonth()+1); if ((intDay == startDay) && (0 == daily)){ daily = 1;} var daytemp=daily<10?("0"+daily):(daily); var d="<"+newCal.getFullYear()+"-"+montemp+"-"+daytemp+">"; if(day==daily) cell.className="DayNow"; else if(intDay==6) cell.className = "DaySat"; else if (intDay==0) cell.className ="DaySun"; else cell.className="Day"; if ((daily > 0) && (daily <= intDaysInMonth)) { cell.innerText = daily; //处理计划日期 if(dates!="" || dates!=null){ var datelist =[];//日期 datelist=dates.split(","); var priceslist=[];//价格list priceslist=price.split(","); var numlist=[]; numlist=num.split(","); // 循环日期 for(var i=0;i<datelist.length-1;i++){ //日期 dat=datelist[i]; yead=dat.substring(0,4); md=dat.substring(5,7); datd=dat.substring(8,10); //价格 money=priceslist[i]; peple=numlist[i]; if(md>=10){ md=md; }else{ md=md.substring(1,2); } if(peple>9){ peple=">9"; }else if(peple<0 || peple==0){ peple="0"; } if(yead==year && datd==daily && md==month+1){ cell.innerText = daily+"余位"+peple+" ¥"+money; cell.className="DayNow2"; } } } daily++; } else { cell.className="CalendarTD"; cell.innerText = ""; } } document.all.year.value=year; document.all.month.value=month+1; } function subMonth() { if ((month-1)<0) { month=11; year=year-1; } else { month=month-1; } Calendar(); } function addMonth() { if((month+1)>11) { month=0; year=year+1; } else { month=month+1; } Calendar(); } function setDate() { if (document.all.month.value<1||document.all.month.value>12) { alert("月的有效范围在1-12之间!"); return; } year=Math.ceil(document.all.year.value); month=Math.ceil(document.all.month.value-1); Calendar(); } function buttonOver() { var obj = window.event.srcElement; obj.runtimeStyle.cssText = "background-color:#FFFFFF"; // obj.className="Hover"; } function buttonOut() { var obj = window.event.srcElement; window.setTimeout(function(){obj.runtimeStyle.cssText = "";},300); } 页面代码: <%@ page import="java.util.*,com.mtravel.util.Misc" contentType="text/html;charset=utf-8"%> <%@ page import="com.xixi.util.*"%> <jsp:useBean id="lookupBean" scope="application" class="com.mtravel.base.Lookup" /> <jsp:useBean id="routeManage" scope="session" class="com.xixi.websites.RouteManage" /> <jsp:useBean id="webInfoBean" scope="application" class="com.xixi.websites.WebInfo" /> <% String title = "线路介绍"; HashMap<String, String> webInfo = webInfoBean.getWebConfigInfo(request); HashMap<String, String> formInfo = routeManage.getFormInfo2(request); String from = formInfo.get("from"); //index2, linelist, searlinelist String partEnname = formInfo.get("part_enname"); String routeInfoID = formInfo.get("route_info_id"); String templateFolder = webInfo.get("template"); //产品信息 HashMap<String, String> routeInfo = routeManage .getRouteInfoByID(routeInfoID); String routeSource = routeInfo.get("route_source"); ArrayList<HashMap<String, String>> planList = routeManage.getSalePlanList(routeSource, routeInfo.get("route_id")); //返回的URI String returnUri = "index2.jsp"; if ("linelist".equals(from)) { returnUri = "linelist.jsp?part_enname=" + routeInfo.get("part_enname") + "&part_name=" + java.net.URLEncoder.encode(formInfo.get("part_name"), "UTF-8"); } else if ("searlinelist".equals(from)) { returnUri = "searlinelist.jsp?part_enname=" + formInfo.get("part_enname") + "&part_name=" + formInfo.get("part_name") + "&route_days=" + formInfo.get("route_days") + "&dest_city=" + formInfo.get("dest_city"); } else if ("index2".equals(from)) { returnUri = "index2.jsp?next=1"; } String selectedID = ""; if (routeManage.isAction(formInfo, "selected_id")) { //选择计划 selectedID = (String) formInfo.get("selected_id"); } else if (planList.size() > 0) { //进入页面默认选择第一条计划 selectedID = planList.get(0).get("route_plan_id"); } HashMap<String, String> selectedPlanInfo = Misc .isNullString(selectedID) ? new HashMap<String, String>() : routeManage.getRoutePlanInfoByID(routeSource, selectedID); //文档相关 String docURLParam = Misc.isNullString(selectedID) ? null : routeManage.getRouteDocURLParam(routeSource, selectedID, request); %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><%=title%>--<%=webInfoBean.getWebConfigInfo(request) .get("website_title")%></title> <link href="css/base.css" rel="stylesheet" type="text/css" /> <link href="css/index.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/dates.js"></script> <style type="text/css"> .Calendar {font-family: verdana;text-decoration: none;width: 600;background-color: #C0D0E8;font-size: 9pt;border:0px dotted #1C6FA5;} .CalendarTD {font-family: verdana;font-size: 7pt;color: #000000;height: 20px;width:11%;text-align: center;} .DayNow {font-family: verdana;font-size: 7pt;font-weight: bold;color: #000000;height: 20px;text-align: center; width: 50px;} .DayNow2 {font-family: verdana;font-size: 7pt;font-weight: bold;color: #ff0000;background-color: #FCFBF9;height: 20px;width: 50px;text-align: center;} </style> </head> <body> <!-- 头部 --> <jsp:include page="head2.jsp"></jsp:include> <!-- 头部 --> <!----> <!----> <div class="product"> <div class="Pright"> <div class="sub_guide"><span><a href="http://www.xixi.com:812/xixi/index2.jsp?next=1">HOME</a></span>您所在位置: 网站首页 >> <%=java.net.URLDecoder.decode(formInfo.get("part_name"),"UTF-8")%> >> 线路信息</div> <!--出境游--> <div class="sub_detail"> <h2><%=formInfo.get("route_name")%></h2> <div class="border1 mt15"> <div class="border_title">出发日期与价格</div> <div class="datepadding"> <table width="720" border="0" align="center" cellpadding="0" cellspacing="0" class="calendar" > <tr> <td rowspan="7" align="center" valign="top" style="padding:10px 0;"> <div class="month"> <input type="hidden" name="cityList" id="cityList" value="<%=planList%>"/> <ul> <li> <a href="javaScript:subMonth();"><img src="images/last.gif" width="78" height="17" border="0" /></a></li> <li class="onmonth"> <input name="year" type="text" size="4" readonly="readonly" style="border-left:0px;border-top:0px;border-right:0px;border-bottom:1px;font:14px/36px Microsoft YaHei; font-weight:bold;text-align:center; color:#58595b; padding:5px 0; " /><br /> <input name="month" type="text" size="1" readonly="readonly" style="border-left:0px;border-top:0px;border-right:0px;border-bottom:1px;font:14px/36px Microsoft YaHei; font-weight:bold;text-align:center; color:#58595b; padding:5px 0; " />月</li> <li><a href="JavaScript:addMonth()"><img src="images/next.gif" width="78" height="17" border="0" /></a></li> </ul> </div> </td> <td> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="calendar" id="caltable"> <thead style="height:80"> <Script LANGUAGE="JavaScript"> document.write("<TH id=diary >" + days[0] + "</TH>"); for (var intLoop = 1; intLoop < days.length-1;intLoop++) document.write("<TH id=diary>" + days[intLoop] + "</TH>"); document.write("<TH id=diary>" + days[intLoop] + "</TH>"); </Script></thead> <TBODY border=1 cellspacing="0" cellpadding="0" ID="calendar" ALIGN=CENTER> <Script LANGUAGE="JavaScript"> for (var intWeeks = 0; intWeeks < 6; intWeeks++) { document.write("<TR style='cursor:hand'>"); for (var intDays = 0; intDays < days.length;intDays++) document.write("<TD class=CalendarTD ></TD>"); document.write("</TR>"); } </Script> </TBODY > <% StringBuffer dates =new StringBuffer();//日期 StringBuffer num=new StringBuffer();//数量 StringBuffer price=new StringBuffer();//价格 for (int i = 0; i < planList.size(); i++) { HashMap<String, String> rec = planList.get(i); dates.append(rec.get("depart_time")).append(","); num.append(rec.get("canbe_ordered_num")).append(","); price.append(rec.get("price_a")).append(","); } %> <input type="hidden" name="dates" id="dates" value="<%=dates %>"/> <input type="hidden" name="num" id="num" value="<%=num %>"/> <input type="hidden" name="price" id="price" value="<%=price %>"/> <Script LANGUAGE="JavaScript"> Calendar(); </Script> </table> </td> </tr> </table> </div> </div> <div class="border1 mt15"> <div class="border_title">价格说明</div> <div class="conaprice"> <b>出发日期:</b><%=Misc.getStr(selectedPlanInfo.get("depart_time"))%>(您可在上面日历表中重新选择出发日期) <br /> <b>出发城市:</b><%=Misc.getStr(selectedPlanInfo.get("start_city"))%> <br /> <b>出游行程:</b><%=Misc.getStr(selectedPlanInfo.get("route_days"))%>天 <table width="407" border="0" cellspacing="0" cellpadding="0" class="cpric"> <tr> <th width="103">价格名称</th> <th width="151">价格(人民币)</th> </tr> <% if(!Misc.getStr(selectedPlanInfo.get("price_name_a")).equals("") && !Misc.getStr(selectedPlanInfo.get("price_a")).equals("") && !Misc.getStr(selectedPlanInfo.get("price_a")).equals("0.00") ){ %> <tr> <td class="ftd"><%=Misc.getStr(selectedPlanInfo.get("price_name_a"))%></td> <td align="center"><%=Misc.getStr(selectedPlanInfo.get("price_a"))%></td> </tr> <% }%> <% if(!Misc.getStr(selectedPlanInfo.get("price_name_b")).equals("") && !Misc.getStr(selectedPlanInfo.get("price_b")).equals("") && !Misc.getStr(selectedPlanInfo.get("price_b")).equals("0.00") ){ %> <tr> <td class="ftd"><%=Misc.getStr(selectedPlanInfo.get("price_name_b"))%></td> <td align="center"><%=Misc.getStr(selectedPlanInfo.get("price_b"))%></td> </tr> <%} %> <% if(!Misc.getStr(selectedPlanInfo.get("price_name_c")).equals("") && !Misc.getStr(selectedPlanInfo.get("price_c")).equals("") && !Misc.getStr(selectedPlanInfo.get("price_c")).equals("0.00") ){ %> <tr> <td class="ftd"><%=Misc.getStr(selectedPlanInfo.get("price_name_c"))%></td> <td align="center"><%=Misc.getStr(selectedPlanInfo.get("price_c"))%></td> </tr> <% }%> <% if(!Misc.getStr(selectedPlanInfo.get("price_name_d")).equals("") && !Misc.getStr(selectedPlanInfo.get("price_d")).equals("") && !Misc.getStr(selectedPlanInfo.get("price_d")).equals("0.00") ){ %> <tr> <td class="ftd"><%=Misc.getStr(selectedPlanInfo.get("price_name_d"))%></td> <td align="center"><%=Misc.getStr(selectedPlanInfo.get("price_d"))%></td> </tr> <%} %> </table> </div> </div> <div class="border1 mt15"> <div class="border_title">行程特色</div> <div class="cona"> <% if (!"".equals(Misc.ShowBody(selectedPlanInfo.get("journey_tip")))) { %><%=Misc.ShowBody(selectedPlanInfo.get("journey_tip"))%> <% } else {%> 暂无相关信息! <%} %> </div> </div> <div class="border1 mt15"> <div class="border_title">参考行程</div> <div class="cona"> <% if (docURLParam == null || "".equals(docURLParam)) { if (!selectedPlanInfo.isEmpty()) { if (!Misc.isNullString(selectedPlanInfo.get("journey_url")) && selectedPlanInfo.get("company_loc").equals( webInfoBean.getWebConfigInfo(request).get( "location_code"))) { docURLParam = routeManage.getRouteDocURLParam( routeSource, selectedID); } } } if (docURLParam != null && !"".equals(docURLParam)) { %> <a href="system/filedownload?<%=docURLParam%>" class="normal"><img src="<%=templateFolder%>/images/word16.gif" width="16" height="16" alt="" style="border: 0px" /> <% } else { %>暂无行程文档可供! <% } %> </div> </div> <div class="border1 mt15"> <div class="border_title">费用说明</div> <div class="cona"> <% if (!"".equals(Misc.ShowBody(selectedPlanInfo.get("sell_must_know")))) { %><%=Misc.ShowBody(selectedPlanInfo.get("sell_must_know"))%> <% } else {%> 暂无相关信息! <%} %> </div> </div> <div class="border1 mt15"> <div class="border_title">温馨提示</div> <div class="cona"> <% if (!"".equals(Misc.ShowBody(selectedPlanInfo.get("warm_tips")))) { %> <%=Misc.ShowBody(selectedPlanInfo.get("warm_tips"))%> <% } else { %> 暂无相关信息! <% } %> </div> </div> </div> </div> <div class="Pleft"> <jsp:include page="leftpart.jsp"></jsp:include> </div> <div class="clear"></div> </div> <div class="foot"> <h3><a href="#">关于我们</a> | <a href="#">联系我们</a> | <a href="#">我有建议</a> | <a href="#">广告服务</a> | <a href="#">网站联盟</a> | <a href="#">帮助中心</a></h3> Copyright 2006-2010 xixi旅游网<br /> 营业执照 | 粤ICP证B2-20121313 </div> </body> </html>