Home >Database >Mysql Tutorial >用JSP实现的一个日历程序_MySQL

用JSP实现的一个日历程序_MySQL

WBOY
WBOYOriginal
2016-06-01 14:11:01910browse

  
 
 
  String month; 
%> 
  year =request.getParameter("year"); 
%> 
 

 
 
 
<script> <br><!-- <br>function changeMonth() <br>{ <br>var mm="calendar.jsp?month="+document.sm.elements[0].selectedIndex+"&year=" <br>+<%=year%>; <br>window.open(mm,"_self"); <br>} <br>//--></script> 
 
 
days=new String[42]; 
for(int i=0;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 { 
  days[firstIndex+i]=String.valueOf(i+1); 
 } 
%> 
 
 
  年  月 
 
 
 
 
    
    
    
    
    
    
    
  
 
 
      
     
    
  
 
 
 
六 
t>
nter"> 
    &month=&d 
ate=" target="main">
 
 
 
  
 
 
 
 
 size=4 maxlength 
=4>
 
 
<script> <br><!-- <br> document.sm.month.options.selectedIndex=<%=month%>; <br>//--> <br></script> 
 
   
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn