主题:发个贴,签个到(内容为回复某君N天前的日期控件URL问题)
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
a{
text-decoration:none;
color:#FF0000;
font-size:12.5px;
}
td{
font-size:12.5px;
color:#F00;
}
-->
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var dDate = new Date();
var dCurMonth = dDate.getMonth();
var dCurDayOfMonth = dDate.getDate();
var dCurYear = dDate.getFullYear();
var objPrevElement = new Object();
function fSetSelectedDay(URL)
{
alert(URL)
}
function fGetDaysInMonth(iMonth, iYear)
{
var dPrevDate = new Date(iYear, iMonth, 0);
return dPrevDate.getDate();
}
function fBuildCal(iYear, iMonth, iDayStyle)
{
var aMonth = new Array();
aMonth[0] = new Array(7);
aMonth[1] = new Array(7);
aMonth[2] = new Array(7);
aMonth[3] = new Array(7);
aMonth[4] = new Array(7);
aMonth[5] = new Array(7);
aMonth[6] = new Array(7);
var dCalDate = new Date(iYear, iMonth-1, 1);
var iDayOfFirst = dCalDate.getDay();
var iDaysInMonth = fGetDaysInMonth(iMonth, iYear);
var iVarDate = 1;
var i, d, w;
if (iDayStyle == 2)
{
aMonth[0][0] = "日";
aMonth[0][1] = "一";
aMonth[0][2] = "二";
aMonth[0][3] = "三";
aMonth[0][4] = "四";
aMonth[0][5] = "五";
aMonth[0][6] = "六";
}
else if (iDayStyle == 1)
{
aMonth[0][0] = "Sun";
aMonth[0][1] = "Mon";
aMonth[0][2] = "Tue";
aMonth[0][3] = "Wed";
aMonth[0][4] = "Thu";
aMonth[0][5] = "Fri";
aMonth[0][6] = "Sat";
}
else
{
aMonth[0][0] = "Su";
aMonth[0][1] = "Mo";
aMonth[0][2] = "Tu";
aMonth[0][3] = "We";
aMonth[0][4] = "Th";
aMonth[0][5] = "Fr";
aMonth[0][6] = "Sa";
}
for (d = iDayOfFirst; d < 7; d++)
{
aMonth[1][d] = iVarDate;
iVarDate++;
}
for (w = 2; w < 7; w++)
{
for (d = 0; d < 7; d++)
{
if (iVarDate <= iDaysInMonth)
{
aMonth[w][d] = iVarDate;
iVarDate++;
}
}
}
//alert(aMonth)
return aMonth;
}
function fDrawCal(iYear, iMonth,iDayStyle, URL)
{
//alert(iYear+"\n"+iMonth+"\n"+URL)
var myMonth;
myMonth = fBuildCal(iYear, iMonth, iDayStyle);
document.write("<table cellspacing='1' bgcolor='#FFFFFF' width=\"300\">");
document.write("<tr height='18'>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][0] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][1] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][2] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][3] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][4] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][5] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][6] + "</td>");
document.write("</tr>");
for (w = 1; w < 7; w++)
{
for (d = 0; d < 7; d++)
{
var URL1=""
document.write("<td align='center' valign='top' id=calCell bgcolor='#F3F3F3'>");
if (!isNaN(myMonth[w][d]))
{
URL1 +=URL+"?year="+iYear;
URL1 +="&month="+iMonth;
URL1 +="&date="+myMonth[w][d];
document.write("<a href=\"javascript:fSetSelectedDay('"+URL1+"');\"><font id=calDateText name=calDateText>" + myMonth[w][d] + "</font></a>");
}
else
{
document.write("<a href=\"#\"><font id=calDateText name=calDateTex>&nbsp;</font></a>");
}
document.write("</td>")
}
document.write("</tr>");
}
document.write("</table>")
}
function fUpdateCal(iYear, iMonth, opid, URL)
{
myMonth = fBuildCal(iYear, iMonth);
objPrevElement.bgColor = "";
document.all.calSelectedDate.value = "";
//alert(iYear+"\n"+iMonth)
var calDateText = document.getElementsByName("calDateText")
//alert(calDateText)
for (w = 1; w < 7; w++)
{
for (d = 0; d < 7; d++)
{
var URL1 = ""
if (!isNaN(myMonth[w][d]))
{
URL1 +=URL+"?year="+iYear;
URL1 +="&month="+iMonth;
URL1 +="&date="+myMonth[w][d];
//alert(calDateText[((7*w)+d)-7])
calDateText[((7*w)+d)-7].innerText = myMonth[w][d];
calDateText[((7*w)+d)-7].parentElement.href="javascript:fSetSelectedDay('"+URL1+"');";
}
else
{
calDateText[((7*w)+d)-7].innerText = " ";
}
}
}
}
// End -->
function num(n1,n2)
{
for($i=n1;$i<=n2;$i++)
{
document.write('<option value="'+$i+'">'+$i+'</option>');
}
}
function getSelectedValue(name){
var obj=document.getElementById(name);
return obj.value; //如此简单,直接用其对象的value属性便可获取到
}
</script>
</head>
<body>
<script language="JavaScript" for="window" event="onload">
<!-- Begin
var dCurDate = new Date();
frmCalendarSample.tbSelMonth.options[dCurDate.getMonth()].selected = true;
for (i = 0; i < frmCalendarSample.tbSelYear.length; i++)
if (frmCalendarSample.tbSelYear.options[i].value == dCurDate.getFullYear()) frmCalendarSample.tbSelYear.options[i].selected = true;
// End -->
</script>
<form name="frmCalendarSample" method="get">
<input type="hidden" name="calSelectedDate" value="">
<table cellspacing="1" bgcolor="#0099FF">
<tr align="center" valign="middle">
<td bgcolor="#FFFFFF" class="a1">
<script language="JavaScript">
var dCurDate = new Date();
document.write("今天是"+dCurDate.getFullYear()+"年"+(dCurDate.getMonth()+1)+"月"+dCurDate.getDate()+"日!");
</script>
</td></tr>
<tr><td bgcolor="#FFFFFF">
<table width="100%" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td align="center" bgcolor="#0099FF">
<select name="tbSelYear" onChange="fUpdateCal(document.frmCalendarSample.tbSelYear.value, document.frmCalendarSample.tbSelMonth.value,tbSelYear,'02.php')">
<script>num(2003,2012);</script>
</select>
</td>
<td bgcolor="#0099FF" align="center">
<select name="tbSelMonth" onChange="fUpdateCal(document.frmCalendarSample.tbSelYear.value, document.frmCalendarSample.tbSelMonth.value,tbSelMonth,'02.php')">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
</td>
</tr></table>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center">
<input name="ye" id="ye" type="hidden"/>
<script language="JavaScript">
fDrawCal(dCurDate.getFullYear(), dCurDate.getMonth()+1, 2, "02.php");
</script>
</td>
</tr>
</table>
</form>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
a{
text-decoration:none;
color:#FF0000;
font-size:12.5px;
}
td{
font-size:12.5px;
color:#F00;
}
-->
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var dDate = new Date();
var dCurMonth = dDate.getMonth();
var dCurDayOfMonth = dDate.getDate();
var dCurYear = dDate.getFullYear();
var objPrevElement = new Object();
function fSetSelectedDay(URL)
{
alert(URL)
}
function fGetDaysInMonth(iMonth, iYear)
{
var dPrevDate = new Date(iYear, iMonth, 0);
return dPrevDate.getDate();
}
function fBuildCal(iYear, iMonth, iDayStyle)
{
var aMonth = new Array();
aMonth[0] = new Array(7);
aMonth[1] = new Array(7);
aMonth[2] = new Array(7);
aMonth[3] = new Array(7);
aMonth[4] = new Array(7);
aMonth[5] = new Array(7);
aMonth[6] = new Array(7);
var dCalDate = new Date(iYear, iMonth-1, 1);
var iDayOfFirst = dCalDate.getDay();
var iDaysInMonth = fGetDaysInMonth(iMonth, iYear);
var iVarDate = 1;
var i, d, w;
if (iDayStyle == 2)
{
aMonth[0][0] = "日";
aMonth[0][1] = "一";
aMonth[0][2] = "二";
aMonth[0][3] = "三";
aMonth[0][4] = "四";
aMonth[0][5] = "五";
aMonth[0][6] = "六";
}
else if (iDayStyle == 1)
{
aMonth[0][0] = "Sun";
aMonth[0][1] = "Mon";
aMonth[0][2] = "Tue";
aMonth[0][3] = "Wed";
aMonth[0][4] = "Thu";
aMonth[0][5] = "Fri";
aMonth[0][6] = "Sat";
}
else
{
aMonth[0][0] = "Su";
aMonth[0][1] = "Mo";
aMonth[0][2] = "Tu";
aMonth[0][3] = "We";
aMonth[0][4] = "Th";
aMonth[0][5] = "Fr";
aMonth[0][6] = "Sa";
}
for (d = iDayOfFirst; d < 7; d++)
{
aMonth[1][d] = iVarDate;
iVarDate++;
}
for (w = 2; w < 7; w++)
{
for (d = 0; d < 7; d++)
{
if (iVarDate <= iDaysInMonth)
{
aMonth[w][d] = iVarDate;
iVarDate++;
}
}
}
//alert(aMonth)
return aMonth;
}
function fDrawCal(iYear, iMonth,iDayStyle, URL)
{
//alert(iYear+"\n"+iMonth+"\n"+URL)
var myMonth;
myMonth = fBuildCal(iYear, iMonth, iDayStyle);
document.write("<table cellspacing='1' bgcolor='#FFFFFF' width=\"300\">");
document.write("<tr height='18'>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][0] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][1] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][2] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][3] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][4] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][5] + "</td>");
document.write("<td align='center' valign='middle' class='bg'>" + myMonth[0][6] + "</td>");
document.write("</tr>");
for (w = 1; w < 7; w++)
{
for (d = 0; d < 7; d++)
{
var URL1=""
document.write("<td align='center' valign='top' id=calCell bgcolor='#F3F3F3'>");
if (!isNaN(myMonth[w][d]))
{
URL1 +=URL+"?year="+iYear;
URL1 +="&month="+iMonth;
URL1 +="&date="+myMonth[w][d];
document.write("<a href=\"javascript:fSetSelectedDay('"+URL1+"');\"><font id=calDateText name=calDateText>" + myMonth[w][d] + "</font></a>");
}
else
{
document.write("<a href=\"#\"><font id=calDateText name=calDateTex>&nbsp;</font></a>");
}
document.write("</td>")
}
document.write("</tr>");
}
document.write("</table>")
}
function fUpdateCal(iYear, iMonth, opid, URL)
{
myMonth = fBuildCal(iYear, iMonth);
objPrevElement.bgColor = "";
document.all.calSelectedDate.value = "";
//alert(iYear+"\n"+iMonth)
var calDateText = document.getElementsByName("calDateText")
//alert(calDateText)
for (w = 1; w < 7; w++)
{
for (d = 0; d < 7; d++)
{
var URL1 = ""
if (!isNaN(myMonth[w][d]))
{
URL1 +=URL+"?year="+iYear;
URL1 +="&month="+iMonth;
URL1 +="&date="+myMonth[w][d];
//alert(calDateText[((7*w)+d)-7])
calDateText[((7*w)+d)-7].innerText = myMonth[w][d];
calDateText[((7*w)+d)-7].parentElement.href="javascript:fSetSelectedDay('"+URL1+"');";
}
else
{
calDateText[((7*w)+d)-7].innerText = " ";
}
}
}
}
// End -->
function num(n1,n2)
{
for($i=n1;$i<=n2;$i++)
{
document.write('<option value="'+$i+'">'+$i+'</option>');
}
}
function getSelectedValue(name){
var obj=document.getElementById(name);
return obj.value; //如此简单,直接用其对象的value属性便可获取到
}
</script>
</head>
<body>
<script language="JavaScript" for="window" event="onload">
<!-- Begin
var dCurDate = new Date();
frmCalendarSample.tbSelMonth.options[dCurDate.getMonth()].selected = true;
for (i = 0; i < frmCalendarSample.tbSelYear.length; i++)
if (frmCalendarSample.tbSelYear.options[i].value == dCurDate.getFullYear()) frmCalendarSample.tbSelYear.options[i].selected = true;
// End -->
</script>
<form name="frmCalendarSample" method="get">
<input type="hidden" name="calSelectedDate" value="">
<table cellspacing="1" bgcolor="#0099FF">
<tr align="center" valign="middle">
<td bgcolor="#FFFFFF" class="a1">
<script language="JavaScript">
var dCurDate = new Date();
document.write("今天是"+dCurDate.getFullYear()+"年"+(dCurDate.getMonth()+1)+"月"+dCurDate.getDate()+"日!");
</script>
</td></tr>
<tr><td bgcolor="#FFFFFF">
<table width="100%" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td align="center" bgcolor="#0099FF">
<select name="tbSelYear" onChange="fUpdateCal(document.frmCalendarSample.tbSelYear.value, document.frmCalendarSample.tbSelMonth.value,tbSelYear,'02.php')">
<script>num(2003,2012);</script>
</select>
</td>
<td bgcolor="#0099FF" align="center">
<select name="tbSelMonth" onChange="fUpdateCal(document.frmCalendarSample.tbSelYear.value, document.frmCalendarSample.tbSelMonth.value,tbSelMonth,'02.php')">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
</td>
</tr></table>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="center">
<input name="ye" id="ye" type="hidden"/>
<script language="JavaScript">
fDrawCal(dCurDate.getFullYear(), dCurDate.getMonth()+1, 2, "02.php");
</script>
</td>
</tr>
</table>
</form>
</body>
</html>