JSP:
<td width="15%" align="right">开始日期:</td>
<td width="35%" class="fieldname">
<input type="text" name="stDate" class="inputtext" size="8">
<input type="button" value="..." onclick="javascript:fPopCalendar(stDate);">
</td>
<td width="15%" align="right">开始日期:</td>
<td width="35%" class="fieldname">
<input type="text" name="stDate" class="inputtext" size="8">
<input type="button" value="..." onclick="javascript:fPopCalendar(stDate);">
</td>
解决方案 »
- java 取磁盘信息??
- 怎样实现一个Servlet.response()实现两次转发?
- 发布到tomcat时,java程序未编译,在WEB-INF/classes中没有.class文件 急~急~~急~~!!!!
- 使用JBOSS的一个故障
- 奇怪的问题,各位帮忙看看(STRUTS)
- 一个关于struts的问题
- 请问现在有什么办法可以解决JAVA读写MS Office Word这个问题吗?
- Eclipse+Jboss开发中的问题,急!!!!!
- 经常的用j2ee,但是谁能用经典的比喻阐述一下j2ee的含义
- javamail发邮件为什么出错,请相助
- java ip地址 32位整型
- jbuilder 2005中,所有的jsp,html,xml文件(除了.java)都无法切换至代码视图,怎么办呀??
好急哦,麻烦你写出来好吗
var gdCtrl = new Object();
var gcGray = "inactivecaption";
var gcToggle = "#FFE0E0";
var gcBG = "#E0FFFF";
var oDatePopup = window.createPopup();
var gMonths = new Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");var giYear;
var giMonth;
var giDay;
fSetCurDate(new Date());
//To set current date of the Calendar
function fSetCurDate(dt)
{
giYear = dt.getFullYear();
giMonth = dt.getMonth()+1;
giDay = dt.getDate();
}//To format the date as it will be returned to the text box
function fSetDate(iYear, iMonth, iDay)
{
var cMonth;
if (iDay < 10) iDay = '0'+iDay;
if (iMonth < 10) iMonth = '0'+iMonth;
return(iYear+"-" + iMonth + "-"+iDay);
}//To set the currently selected date of the calendar in the text box
function fSetSelected(aCell,idx)
{
var iOffset = 0;
var iYear = parseInt(tbSelYear.value);
var iMonth = parseInt(tbSelMonth.value); aCell.bgColor = gcBG;
oDatePopup.hide(); with (aCell) {
var iDay = parseInt(innerText);
if (style.color==gcGray)
iOffset = (idx<7)?-1:1;
iMonth += iOffset;
if (iMonth<1) {
iYear--;
iMonth = 12;
} else
if (iMonth>12) {
iYear++;
iMonth = 1;
}
}
gdCtrl.value = fSetDate(iYear, iMonth, iDay);
}//Point class
function Point(iX, iY)
{
this.x = iX;
this.y = iY;
}//To set a 2D array based on Year and Month
function fBuildCal(iYear, iMonth)
{
var aMonth=new Array();
for(i=1;i<7;i++) {
aMonth[i]=new Array(i);
} var dCalDate=new Date(iYear, iMonth-1, 1);
var iDayOfFirst=dCalDate.getDay();
var iDaysInMonth=new Date(iYear, iMonth, 0).getDate();
var iOffsetLast=new Date(iYear, iMonth-1, 0).getDate()-iDayOfFirst+1;
var iDate = 1;
var iNext = 1; for (d = 0; d < 7; d++)
aMonth[1][d] = (d<iDayOfFirst)?-(iOffsetLast+d):iDate++; for (w = 2; w < 7; w++)
for (d = 0; d < 7; d++)
aMonth[w][d] = (iDate<=iDaysInMonth)?iDate++:-(iNext++);
return aMonth;
}//To darw the inner table for all the dates
function fDrawCal(iYear, iMonth, iCellHeight, sDateTextSize)
{
var WeekDay = new Array("日","一","二","三","四","五","六"); with (oDatePopup.document) { write("<tr class='PopUpS1' >");
for(i=0; i<7; i++)
write("<td align='center' >" + WeekDay[i] + "</td>");
write("</tr>");
for (w = 1; w < 7; w++) {
write("<tr class='PopUpS2' >");
for (d = 0; d < 7; d++)
write("<td id='calCell' onMouseOver='this.bgColor=parent.gcToggle' onMouseOut='this.bgColor=parent.gcBG' onclick='parent.fSetSelected(this,"+ ((w-1)*7+d+1) +")' align='center'></TD>");
write("</tr>");
}
}
}//To update date values calculated using fBuildCal
function fUpdateCal(iYear, iMonth)
{
myMonth = fBuildCal(iYear, iMonth);
var i = 0;
for (w = 0; w < 6; w++)
for (d = 0; d < 7; d++)
with (oDatePopup.document.all("calCell")[(7*w)+d]) {
style.borderStyle = 'solid';
style.borderWidth = "1px";
style.padding = "2px";
if (myMonth[w+1][d]<0) {
style.color = gcGray;
innerText = -myMonth[w+1][d];
style.borderColor = gcBG;
} else {
style.color = ((d==0)||(d==6))?"red":"buttontext";
if (myMonth[w+1][d] == giDay && iMonth == giMonth && iYear == giYear) {
style.borderColor = "#80D0D0";
style.borderWidth = "1px";
} else {
style.borderColor = gcBG;
}
innerText = myMonth[w+1][d];
}
}
}//To set the current year and month
function fSetYearMon(iYear, iMon)
{
tbSelMonth.options[iMon-1].selected = true;
for (i = 0; i < tbSelYear.length; i++)
if (tbSelYear.options[i].value == iYear)
tbSelYear.options[i].selected = true;
fUpdateCal(iYear, iMon);
}//To set the previous month (with validation for current month as first month and others)
function fPrevMonth()
{
var iMon = tbSelMonth.value;
var iYear = tbSelYear.value; if(iMon==1 && iYear==tbSelYear.options[0].value) return; if (--iMon<1) {
iMon = 12;
iYear--;
} fSetYearMon(iYear, iMon);
}//To set the next month (with validation for current month as last month)
function fNextMonth()
{
var iMon = tbSelMonth.value;
var iYear = tbSelYear.value; if (++iMon>12) {
iMon = 1;
iYear++;
} fSetYearMon(iYear, iMon);
}
未完
var gcGray = "inactivecaption";
var gcToggle = "#FFE0E0";
var gcBG = "#E0FFFF";
var oDatePopup = window.createPopup();
var gMonths = new Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月");var giYear;
var giMonth;
var giDay;
fSetCurDate(new Date());
//To set current date of the Calendar
function fSetCurDate(dt)
{
giYear = dt.getFullYear();
giMonth = dt.getMonth()+1;
giDay = dt.getDate();
}//To format the date as it will be returned to the text box
function fSetDate(iYear, iMonth, iDay)
{
var cMonth;
if (iDay < 10) iDay = '0'+iDay;
if (iMonth < 10) iMonth = '0'+iMonth;
return(iYear+"-" + iMonth + "-"+iDay);
}//To set the currently selected date of the calendar in the text box
function fSetSelected(aCell,idx)
{
var iOffset = 0;
var iYear = parseInt(tbSelYear.value);
var iMonth = parseInt(tbSelMonth.value); aCell.bgColor = gcBG;
oDatePopup.hide(); with (aCell) {
var iDay = parseInt(innerText);
if (style.color==gcGray)
iOffset = (idx<7)?-1:1;
iMonth += iOffset;
if (iMonth<1) {
iYear--;
iMonth = 12;
} else
if (iMonth>12) {
iYear++;
iMonth = 1;
}
}
gdCtrl.value = fSetDate(iYear, iMonth, iDay);
}//Point class
function Point(iX, iY)
{
this.x = iX;
this.y = iY;
}//To set a 2D array based on Year and Month
function fBuildCal(iYear, iMonth)
{
var aMonth=new Array();
for(i=1;i<7;i++) {
aMonth[i]=new Array(i);
} var dCalDate=new Date(iYear, iMonth-1, 1);
var iDayOfFirst=dCalDate.getDay();
var iDaysInMonth=new Date(iYear, iMonth, 0).getDate();
var iOffsetLast=new Date(iYear, iMonth-1, 0).getDate()-iDayOfFirst+1;
var iDate = 1;
var iNext = 1; for (d = 0; d < 7; d++)
aMonth[1][d] = (d<iDayOfFirst)?-(iOffsetLast+d):iDate++; for (w = 2; w < 7; w++)
for (d = 0; d < 7; d++)
aMonth[w][d] = (iDate<=iDaysInMonth)?iDate++:-(iNext++);
return aMonth;
}//To darw the inner table for all the dates
function fDrawCal(iYear, iMonth, iCellHeight, sDateTextSize)
{
var WeekDay = new Array("日","一","二","三","四","五","六"); with (oDatePopup.document) { write("<tr class='PopUpS1' >");
for(i=0; i<7; i++)
write("<td align='center' >" + WeekDay[i] + "</td>");
write("</tr>");
for (w = 1; w < 7; w++) {
write("<tr class='PopUpS2' >");
for (d = 0; d < 7; d++)
write("<td id='calCell' onMouseOver='this.bgColor=parent.gcToggle' onMouseOut='this.bgColor=parent.gcBG' onclick='parent.fSetSelected(this,"+ ((w-1)*7+d+1) +")' align='center'></TD>");
write("</tr>");
}
}
}//To update date values calculated using fBuildCal
function fUpdateCal(iYear, iMonth)
{
myMonth = fBuildCal(iYear, iMonth);
var i = 0;
for (w = 0; w < 6; w++)
for (d = 0; d < 7; d++)
with (oDatePopup.document.all("calCell")[(7*w)+d]) {
style.borderStyle = 'solid';
style.borderWidth = "1px";
style.padding = "2px";
if (myMonth[w+1][d]<0) {
style.color = gcGray;
innerText = -myMonth[w+1][d];
style.borderColor = gcBG;
} else {
style.color = ((d==0)||(d==6))?"red":"buttontext";
if (myMonth[w+1][d] == giDay && iMonth == giMonth && iYear == giYear) {
style.borderColor = "#80D0D0";
style.borderWidth = "1px";
} else {
style.borderColor = gcBG;
}
innerText = myMonth[w+1][d];
}
}
}//To set the current year and month
function fSetYearMon(iYear, iMon)
{
tbSelMonth.options[iMon-1].selected = true;
for (i = 0; i < tbSelYear.length; i++)
if (tbSelYear.options[i].value == iYear)
tbSelYear.options[i].selected = true;
fUpdateCal(iYear, iMon);
}//To set the previous month (with validation for current month as first month and others)
function fPrevMonth()
{
var iMon = tbSelMonth.value;
var iYear = tbSelYear.value; if(iMon==1 && iYear==tbSelYear.options[0].value) return; if (--iMon<1) {
iMon = 12;
iYear--;
} fSetYearMon(iYear, iMon);
}//To set the next month (with validation for current month as last month)
function fNextMonth()
{
var iMon = tbSelMonth.value;
var iYear = tbSelYear.value; if (++iMon>12) {
iMon = 1;
iYear++;
} fSetYearMon(iYear, iMon);
}
//To get the XY location of the object where the calendar will be displayed
function fGetXY(aTag)
{
var oTmp = aTag;
var pt = new Point(0,0);
do {
pt.x += oTmp.offsetLeft;
pt.y += oTmp.offsetTop;
oTmp = oTmp.offsetParent;
}
while(oTmp.tagName!="BODY");
return pt;
}// Main: popCtrl is the widget beyond which you want this calendar to appear;
// dateCtrl is the widget into which you want to put the selected date.
// i.e.: <input type="text" name="dc" readonly>
// <INPUT type="button" value="V" onclick="fPopCalendar(dc,dc);return false">
function fPopCalendar1(dateCtrl)
{
gdCtrl = dateCtrl;
popCtrl = dateCtrl;
var sDt;
sDt = dateCtrl.value;
if (sDt.length==10)
{
sDt = sDt.substr(5,2) + "/" + sDt.substr(8,2) + "," + sDt.substr(0,4)
fSetCurDate(new Date(sDt));
}
fSetYearMon(giYear, giMonth);
var point = fGetXY(popCtrl);
var l = point.x+2;
var t = point.y+popCtrl.offsetHeight+3;
oDatePopup.show(l, t, 200, 168, document.body);
}with (oDatePopup.document)
{
write("<link rel='stylesheet' href='/css/style.css' type='text/css'>");
write("<BODY leftmargin=0 topmargin=0 scroll=no>")
write("<table width='100%' cellpadding='0' cellspacing='0' class='PopUpCal'>");
write(" <TR height=25>");
write(" <td valign='middle' align='center'>");
write(" <select id='tbSelMonth' name='tbSelMonth' style='font:8pt;' onChange='parent.fUpdateCal(tbSelYear.value, tbSelMonth.value)'>");
for (i=0; i<12; i++)
write(" <option value='"+(i+1)+"'>"+gMonths[i]+"</option>");
write(" </select> ");
write(" <select id='tbSelYear' name='tbSelYear' style='font:8pt;' onChange='parent.fUpdateCal(tbSelYear.value, tbSelMonth.value)'>");
// Available year for selection
for(i=1900;i<2021;i++)
write(" <option value='"+i+"'>"+i+"</OPTION>");
write(" </select>");
write(" </td>");
write(" </TR>");
write(" <TR >");
write(" <TD align='center'>");
write(" <SPAN style='cursor:hand;' onclick='if(tbSelYear.value > tbSelYear.options[0].value) parent.fSetYearMon(parseInt(tbSelYear.value) - 1, tbSelMonth.value);'><A href='#'><img src='/images/back1.gif' onmouseover='javascript: this.src=\"/images/back2.gif\"' onmouseout='javascript: this.src=\"/images/back1.gif\"' alt='prev year' style='cursor:hand' align='absmiddle' border='0'></A></SPAN> ");
write(" <SPAN style='cursor:hand;' onclick='parent.fPrevMonth();'><A href='#'><img src='/images/backward1.gif' onmouseover='javascript: this.src=\"/images/backward2.gif\"' onmouseout='javascript: this.src=\"/images/backward1.gif\"' alt='prev month' style='cursor:hand' align='absmiddle' border='0'>></A></SPAN> ");
write(" <SPAN onclick='parent.fSetCurDate(new Date()); parent.fSetYearMon(parent.giYear, parent.giMonth);'><A href='#'><font style='font:12px Arial; font-weight:bold; color:#E0FFFF; vertical-align:middle; '>Today</font></A></SPAN> ");
write(" <SPAN style='cursor:hand;' onclick='parent.fNextMonth();'><A href='#'><img src='/images/forward1.gif' onmouseover='javascript: this.src=\"/images/forward2.gif\"' onmouseout='javascript: this.src=\"/images/forward1.gif\"' alt='next month' style='cursor:hand' align='absmiddle' border='0'></A></SPAN> ");
write(" <SPAN style='cursor:hand;' onclick='parent.fSetYearMon(parseInt(tbSelYear.value) + 1, tbSelMonth.value)'><A href='#'><img src='/images/front1.gif' onmouseover='javascript: this.src=\"/images/front2.gif\"' onmouseout='javascript: this.src=\"/images/front1.gif\"' alt='next year' style='cursor:hand' align='absmiddle' border='0'></A></SPAN>");
write(" </td>");
write(" </TR>");
write(" <TR>");
write(" <td align='center'>");
write(" <table width='100%' cellpadding='0' cellspacing='0' class='PopUpCal2'>");
fDrawCal(giYear, giMonth, 10, '8');
write(" </table>");
write(" </td>");
write(" </TR>");
write("</TABLE>");
}
var tbSelMonth = oDatePopup.document.all("tbSelMonth");
var tbSelYear = oDatePopup.document.all("tbSelYear");
不行哦,说网页有错。