JAVA-JSP Calendar __js

Source: Internet
Author: User
<iframe name=google_ads_frame marginwidth=0 marginheight=0 src= "Http://googleads.g.doubleclick.net/pagead/ads? client=ca-pub-4490194096475053&amp;dt=1228459074265&amp;lmt=1226285677&amp;prev_slotnames= 1891601125&amp;output=html&amp;slotname=3685991503&amp;correlator=1228459074140&amp;url=http% 3a%2f%2fwww.corange.cn%2farchives%2f2008%2f10%2f1803.html&amp;ea=0&amp;ref=http%3a%2f%2fwww.corange.cn %2fhtml%2fcorange__97.html&amp;frm=0&amp;ga_vid=368793713.1228304108&amp;ga_sid=1228459066&amp ; ga_hid=404527361&amp;ga_fc=true&amp;flash=9.0.124.0&amp;u_h=768&amp;u_w=1024&amp;u_ah=715 &amp;u_aw=1024&amp;u_cd=32&amp;u_tz=480&amp;u_java=true&amp;dtd=31 "FrameBorder=0 width=300 Scrolling=no height=250 allowtransparency></iframe> <% @page contenttype= "text/html"%>
<% @page pageencoding= "UTF-8"%>
<!--File name:calendar.jsp-->
<!--display a calendar of any year or month, you can choose a different year and month. Author:rochael zhang-->

<%@ page language= "java" import= "java.util.*"%>

<%! String year;

String month;

%>

<% month =request.getparameter ("month");

Year =request.getparameter ("year");

%>



<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 ">

<title> Day </title>

<script language= "JavaScript" >

<!--

function Changemonth ()

{

var mm= "a.jsp?month=" +document.sm.elements[0].selectedindex+ "&year=" +<%=year%>;

window.open (mm, "_self");

}

--></script>


<%! String days[]; %>

<%

Days=new string[42];

for (int i=0;i<42;i++)

{

Days[i]= "";

}

%>

<%

Calendar thismonth=calendar.getinstance ();

if (month!=null&& (!month.equals ("null"))

Thismonth.set (Calendar.month, Integer.parseint (MONTH));

if (year!=null&& (!year.equals ("null"))

Thismonth.set (Calendar.year, Integer.parseint (year));

Year=string.valueof (Thismonth.get (calendar.year));

Month=string.valueof (Thismonth.get (calendar.month));

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);

}

%>

<body>

<form name= "SM" method= "POST" action= "a.jsp" >

&nbsp;&nbsp;&nbsp;<%=year%> year &nbsp;&nbsp;<%=integer.parseint (month) +1%> month

<table border= "0" width= "height=" >

<div align=center>

<tr>

<th width= "height=" bgcolor= "#FFFF00" ><font color= "Red" > Day </font>

</th>

<th width= "height=" bgcolor= "#FFFF00" > </th>

<th width= "height=" bgcolor= "#FFFF00" > Two </th>

<th width= "height=" bgcolor= "#FFFF00" > Three </th>

<th width= "height=" bgcolor= "#FFFF00" > Four </th>

<th width= "height=" bgcolor= "#FFFF00" > Five </th>

<th width= "height=" bgcolor= "#FFFF00" ><font color= "green" > Six </fon

T></th>

</tr>

<% for (int j=0;j<6;j++) {%>

<tr>

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

&LT;TD bgcolor= "#C0C0C0" valign= "Middle" align= "top" >
<a href= "jump.jsp?year=<%=year%>&month=<%=integer.parseint (month) +1%>&date=<%=days[i] %> "target=" main "><%=days[i]%></a>

</td>

<%}%>

</tr>

<%}%>

</div>

</table>

<table border= "0" width= "height=" >

<tr>

&LT;TD width=30%><select name= "Month" size= "1" onchange= "Changemonth ()" >

<option value= "0" > January </option>

<option value= "1" > February </option>

<option value= "2" > March </option>

<option value= "3" > April </option>

<option value= "4" > May </option>

<option value= "5" > June </option>

<option value= "6" > July </option>

<option value= "7" > August </option>

<option value= "8" > September </option>

<option value= "9" > October </option>

<option value= "Ten" > November </option>

<option value= "One" > December </option>

</select></td>

&LT;TD width=28%><input type=text name= "year" value=<%=year%> size=4 maxlength=4></td>

<td> year </td>

&LT;TD width=28%><input type= "Submit" value= "submitted" ></td>

</tr>

</table>

</FORM>

<script language= "JavaScript" >

<!--

document.sm.month.options.selectedindex=<%=month%>;


-->

</script>

</body>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.