不好意思了,因为所有的代码比较长,贴不上。这是在弹出页面中起主要作用的函数。实现的功能是点击日期可返回所点击的数值,并关闭弹出窗口。如果还不能说明问题的话,我再贴好了。多谢!
Calendar.prototype.cal_data = function() {
var vDate = new Date();
vDate.setDate(1);
vDate.setMonth(this.gMonth);
vDate.setFullYear(this.gYear);
var vFirstDay=vDate.getDay();
var vDay=1;
var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear);
var vOnLastDay=0;
var vCode = ""; /*
Get day for the 1st of the requested month/year..
Place as many blank cells before the 1st day of the month as necessary. 
*/ vCode = vCode + "<TR>";
for (i=0; i<vFirstDay; i++) {
vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(i) + "><FONT SIZE='2' FACE='" + fontface + "'>&nbsp;</FONT></TD>";
}
    
// Write rest of the 1st week
for (j=vFirstDay; j<7; j++) {
vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + "><FONT SIZE='2' FACE='" + fontface + "'>" + 
"<A HREF='#' " + 
"onClick=\"self.opener.document.getElementsByName(getNetuiTagName('" + this.gReturnItem + "', this))[0].value='" + 
this.format_data(vDay) + 
"';window.close();\">" + 
this.format_day(vDay) + 
"</A>" + 
"</FONT></TD>";
vDay=vDay + 1;
}
vCode = vCode + "</TR>"; // Write the rest of the weeks
for (k=2; k<7; k++) {
vCode = vCode + "<TR>"; for (j=0; j<7; j++) {
vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + "><FONT SIZE='2' FACE='" + fontface + "'>" + 
"<A HREF='#' " + 
"onClick=\"self.opener.document.getElementsByName(getNetuiTagName('" + this.gReturnItem + "', this))[0].value='" + 
this.format_data(vDay) + 
"';window.close();\">" + 
this.format_day(vDay) + 
"</A>" + 
"</FONT></TD>";
vDay=vDay + 1; if (vDay > vLastDay) {
vOnLastDay = 1;
break;
}
} if (j == 6)
vCode = vCode + "</TR>";
if (vOnLastDay == 1)
break;
}
// Fill up the rest of last week with proper blanks, so that we get proper square blocks
for (m=1; m<(7-j); m++) {
if (this.gYearly)
vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j+m) + 
"><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'>&nbsp;</FONT></TD>";
else
vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j+m) + 
"><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'>" + m + "</FONT></TD>";
}
return vCode;
}