返回

HTML组件--COMPONENTS ===CALENDAR HTC===

时间:2013-2-17  编辑:邢台网络公司
var text = ""; // initialize accumulative variable to empty string
text += '<TABLE BORDER=' + border + ' CELLSPACING=' + cellspacing + '>'; // table settings
text += '<TH COLSPAN=7 HEIGHT=' + 10 + '>'; // create table header cell
text += '<FONT COLOR="' + headerColor + '" SIZE=' + headerSize + '>'; // set font for table header
text += monthName + ' ' + year;
text += '</FONT>'; // close table header's font settings
text += '</TH>'; // close header cell
// variables to hold constant settings
var openCol = '<TD WIDTH=' + colWidth + ' HEIGHT=' + dayCellHeight + '>';
openCol += '<FONT COLOR="' + dayColor + '">';
var closeCol = '</FONT></TD>';
// create array of abbreviated day names
var weekDay = new Array(7);
weekDay[0] = "Sun";
weekDay[1] = "Mon";
weekDay[2] = "Tues";
weekDay[3] = "Wed";
weekDay[4] = "Thu";
weekDay[5] = "Fri";
weekDay[6] = "Sat";
// create first row of table to set column width and specify week day
text += '<TR ALIGN="center" VALIGN="center">';
for (var dayNum = 0; dayNum < 7; ++dayNum) {
text += openCol + weekDay[dayNum] + closeCol;
}
text += '</TR>';
// declaration and initialization of two variables to help with tables
var dayOfMonth = 1;
var curCell = 1;
for (var row = 1; row <= Math.ceil((lastDate + firstDay - 1) / 7); ++row) {
text += '<TR ALIGN="right" VALIGN="top">';
for (var col = 1; col <= 7; ++col) {
if ((curCell < firstDay) || (dayOfMonth > lastDate)) {
text += '<TD></TD>';
curCell++
} else {
if (dayOfMonth == date) { // current cell represents today's date
text += '<TD><TODAY:DAY value=' + dayOfMonth + '></TODAY:DAY></TD>';
} else {
text += '<TD><ANYDAY:DAY value=' + dayOfMonth + '></ANYDAY:DAY></TD>';
}
dayOfMonth++;
}
}
text += '</TR>';
}
// close all basic table tags
text += '</TABLE>';
text += '</CENTER>';
// print accumulative HTML string
document.write(text);
}
// -->
</SCRIPT>
</BODY>
</HTML>
<<<123>>
回顶部
分享到: