var Frw=106;
var Frh=137;
var Frs=4;
var Hid=true;
document.writeln('<Div id=Calendar1 Author=smart scrolling="no" frameborder=0 style="border:0px solid #EEEEEE ;position: absolute; width: '+Frw+'; height: '+Frh+'; z-index: 250; filter :\'progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#AAAAAA,strength='+Frs+')\' ;display: none"></Div>');function GetTodayDate()
{
today= new Date();
y= today.getYear();
m= (today.getMonth() + 1);
if (m<10)
{
m='0'+m;
}
d= today.getDate();
if (d<10)
{
d='0'+d;
}
return y+'-'+m+'-'+d
}function SetTodayDate(InputBox)
{
HiddenCalendar();
InputBox.value=GetTodayDate();
}
//‥u?Y|~?Y?e2A?@?Nao?P’A-E
function GetFirstWeek(The_Year,The_Month)
{
return (new Date(The_Year,The_Month-1,1)).getDay()
}function GetThisDays(The_Year,The_Month)
{
return (new Date(The_Year,The_Month,0)).getDate()
}
function GetLastDays(The_Year,The_Month)
{
return (new Date(The_Year,The_Month-1,0)).getDate()
}
function RunNian(The_Year)
{
if ((The_Year%400==0) || ((The_Year%4==0) && (The_Year%100!=0)))
return true;
else
return false;
}
function DateIsTrue(asDate){
var lsDate = asDate + "";
var loDate = lsDate.split("-");
if (loDate.length!=3) return false;
var liYear = parseFloat(loDate[0]);
var liMonth = parseFloat(loDate[1]);
var liDay = parseFloat(loDate[2]);
if ((loDate[0].length>4)||(loDate[1].length>2)||(loDate[2].length>2)) return false;
if (isNaN(liYear)||isNaN(liMonth)||isNaN(liDay)) return false;
if ((liYear<1800)||(liYear>2500)) return false;
if ((liMonth>12)||(liMonth<=0)) return false;
if (GetThisDays(liYear,liMonth)<liDay) return false;
return !isNaN(Date.UTC(liYear,liMonth,liDay));
}
function GetCountWeeks(The_Year,The_Month)
{
var Allday;
Allday = 0;
if (The_Year>2000)
{
for (i=2000 ;i<The_Year; i++)
if (RunNian(i))
Allday += 366;
else
Allday += 365;
for (i=2; i<=The_Month; i++)
{
switch (i)
{
case 2 :
if (RunNian(The_Year))
Allday += 29;
else
Allday += 28;
break;
case 3 : Allday += 31; break;
case 4 : Allday += 30; break;
case 5 : Allday += 31; break;
case 6 : Allday += 30; break;
case 7 : Allday += 31; break;
case 8 : Allday += 31; break;
case 9 : Allday += 30; break;
case 10 : Allday += 31; break;
case 11 : Allday += 30; break;
case 12 : Allday += 31; break;
}
}
}
return (Allday+6)%7;
}
function InputValue(InputBox,Year,Month,Day)
{
if (Month<10)
{
Month='0'+Month
}
if (Day<10)
{
Day='0'+Day
}
InputBox.value=Year+"-"+Month+"-"+Day
}
function ForwardMonth(InputBox,Year,Month,Day)
{
Month=Month-1;
if (Month<1)
{
Month=12;
Year=Year-1;
if (Year<1800)
Year=2500;
}
Day=((GetThisDays(Year,Month)<Day)?GetThisDays(Year,Month):Day)
Hid=false;
ShowCalendar(InputBox,Year,Month,Day)
}
function NextMonth(InputBox,Year,Month,Day)
{
Month=Month+1;
if (Month>12)
{
Month=1;
Year=Year+1;
if (Year>2500)
Year=1800;
}
Day=((GetThisDays(Year,Month)<Day)?GetThisDays(Year,Month):Day)
Hid=false;
ShowCalendar(InputBox,Year,Month,Day)
}
function ForwardYear(InputBox,Year,Month,Day)
{
Year=Year-1;
if (Year<1800)
Year=2500;
Day=((GetThisDays(Year,Month)<Day)?GetThisDays(Year,Month):Day)
Hid=false;
ShowCalendar(InputBox,Year,Month,Day)
}
function NextYear(InputBox,Year,Month,Day)
{
Year=Year+1;
if (Year>2500)
Year=1800;
Day=((GetThisDays(Year,Month)<Day)?GetThisDays(Year,Month):Day)
Hid=false;
ShowCalendar(InputBox,Year,Month,Day)
}
function OpenDate1(where)
{
GetCalendar(where)
}
function GetCalendar(where)
{
Hid=false;
var Box_Name=where.name;
var Box_value=where.value;
if (DateIsTrue(Box_value))
{
loDate = Box_value.split("-");
Y= parseFloat(loDate[0]);
M= parseFloat(loDate[1]);
D= parseFloat(loDate[2]);
ShowCalendar(where,Y,M,D);
}
else
{
today= new Date();
y= today.getYear();
m= (today.getMonth() + 1);
d=today.getDate();
ShowCalendar(where,y,m,d);
}
}
function HiddenCalendar()
{
document.all.Calendar1.style.display="none";
}
function CloseCalendar()
{
if (Hid)
document.all.Calendar1.style.display="none";
Hid=true;
}
var Frh=137;
var Frs=4;
var Hid=true;
document.writeln('<Div id=Calendar1 Author=smart scrolling="no" frameborder=0 style="border:0px solid #EEEEEE ;position: absolute; width: '+Frw+'; height: '+Frh+'; z-index: 250; filter :\'progid:DXImageTransform.Microsoft.Shadow(direction=135,color=#AAAAAA,strength='+Frs+')\' ;display: none"></Div>');function GetTodayDate()
{
today= new Date();
y= today.getYear();
m= (today.getMonth() + 1);
if (m<10)
{
m='0'+m;
}
d= today.getDate();
if (d<10)
{
d='0'+d;
}
return y+'-'+m+'-'+d
}function SetTodayDate(InputBox)
{
HiddenCalendar();
InputBox.value=GetTodayDate();
}
//‥u?Y|~?Y?e2A?@?Nao?P’A-E
function GetFirstWeek(The_Year,The_Month)
{
return (new Date(The_Year,The_Month-1,1)).getDay()
}function GetThisDays(The_Year,The_Month)
{
return (new Date(The_Year,The_Month,0)).getDate()
}
function GetLastDays(The_Year,The_Month)
{
return (new Date(The_Year,The_Month-1,0)).getDate()
}
function RunNian(The_Year)
{
if ((The_Year%400==0) || ((The_Year%4==0) && (The_Year%100!=0)))
return true;
else
return false;
}
function DateIsTrue(asDate){
var lsDate = asDate + "";
var loDate = lsDate.split("-");
if (loDate.length!=3) return false;
var liYear = parseFloat(loDate[0]);
var liMonth = parseFloat(loDate[1]);
var liDay = parseFloat(loDate[2]);
if ((loDate[0].length>4)||(loDate[1].length>2)||(loDate[2].length>2)) return false;
if (isNaN(liYear)||isNaN(liMonth)||isNaN(liDay)) return false;
if ((liYear<1800)||(liYear>2500)) return false;
if ((liMonth>12)||(liMonth<=0)) return false;
if (GetThisDays(liYear,liMonth)<liDay) return false;
return !isNaN(Date.UTC(liYear,liMonth,liDay));
}
function GetCountWeeks(The_Year,The_Month)
{
var Allday;
Allday = 0;
if (The_Year>2000)
{
for (i=2000 ;i<The_Year; i++)
if (RunNian(i))
Allday += 366;
else
Allday += 365;
for (i=2; i<=The_Month; i++)
{
switch (i)
{
case 2 :
if (RunNian(The_Year))
Allday += 29;
else
Allday += 28;
break;
case 3 : Allday += 31; break;
case 4 : Allday += 30; break;
case 5 : Allday += 31; break;
case 6 : Allday += 30; break;
case 7 : Allday += 31; break;
case 8 : Allday += 31; break;
case 9 : Allday += 30; break;
case 10 : Allday += 31; break;
case 11 : Allday += 30; break;
case 12 : Allday += 31; break;
}
}
}
return (Allday+6)%7;
}
function InputValue(InputBox,Year,Month,Day)
{
if (Month<10)
{
Month='0'+Month
}
if (Day<10)
{
Day='0'+Day
}
InputBox.value=Year+"-"+Month+"-"+Day
}
function ForwardMonth(InputBox,Year,Month,Day)
{
Month=Month-1;
if (Month<1)
{
Month=12;
Year=Year-1;
if (Year<1800)
Year=2500;
}
Day=((GetThisDays(Year,Month)<Day)?GetThisDays(Year,Month):Day)
Hid=false;
ShowCalendar(InputBox,Year,Month,Day)
}
function NextMonth(InputBox,Year,Month,Day)
{
Month=Month+1;
if (Month>12)
{
Month=1;
Year=Year+1;
if (Year>2500)
Year=1800;
}
Day=((GetThisDays(Year,Month)<Day)?GetThisDays(Year,Month):Day)
Hid=false;
ShowCalendar(InputBox,Year,Month,Day)
}
function ForwardYear(InputBox,Year,Month,Day)
{
Year=Year-1;
if (Year<1800)
Year=2500;
Day=((GetThisDays(Year,Month)<Day)?GetThisDays(Year,Month):Day)
Hid=false;
ShowCalendar(InputBox,Year,Month,Day)
}
function NextYear(InputBox,Year,Month,Day)
{
Year=Year+1;
if (Year>2500)
Year=1800;
Day=((GetThisDays(Year,Month)<Day)?GetThisDays(Year,Month):Day)
Hid=false;
ShowCalendar(InputBox,Year,Month,Day)
}
function OpenDate1(where)
{
GetCalendar(where)
}
function GetCalendar(where)
{
Hid=false;
var Box_Name=where.name;
var Box_value=where.value;
if (DateIsTrue(Box_value))
{
loDate = Box_value.split("-");
Y= parseFloat(loDate[0]);
M= parseFloat(loDate[1]);
D= parseFloat(loDate[2]);
ShowCalendar(where,Y,M,D);
}
else
{
today= new Date();
y= today.getYear();
m= (today.getMonth() + 1);
d=today.getDate();
ShowCalendar(where,y,m,d);
}
}
function HiddenCalendar()
{
document.all.Calendar1.style.display="none";
}
function CloseCalendar()
{
if (Hid)
document.all.Calendar1.style.display="none";
Hid=true;
}
解决方案 »
- 求截取字符串
- 如何实现在页面总嵌入pdf文件在线浏览,就好比嵌入ASPNetFlash控件可以浏览FLASH文件一样
- 关于三层架构中逻辑层的困惑?
- 真诚求教! 100分,请教1个初级问题,求标准最优答案.
- 关于动态加载ASP.NET服务器控件
- asp.net表单提交的一个问题
- 求助高手!!急!!!C#.net 调用db2的存储过程带一个参数并返回记录集 ,如果有原代码继续加分
- 全部分数送上 求asp.net(1.1)网站整合动网论坛8.2(例子)
- 如何在点击取消后,能离开此页面,而不是一定要输入值后?(答即送分!)
- 用WebClient或HttpWebRequest 如何上传byte数据文件?
- asp.net中用C#写的邮件接收程序
- 如何实现 新浪,网易发邮件时 屏幕上有个 “正在发送请稍等”
{
var Now_Year=(The_Year==null?2004:The_Year);
var Now_Month=(The_Month==null?1:The_Month);
var Now_Day=(The_Day==null?1:The_Day);
var Box_Name='window.document.all.'+InputBox.name;
var fw=GetFirstWeek(Now_Year,Now_Month);
var ld=GetLastDays(Now_Year,Now_Month);
var td=GetThisDays(Now_Year,Now_Month);
var isnd=false;
var d=1,w=1;
var FrameContent;
var Frl,Frt,Winw,Winh;
Winw=document.body.offsetWidth;
Winh=document.body.offsetHeight;
Frl=InputBox.getBoundingClientRect().right;
//Frt=InputBox.getBoundingClientRect().top+InputBox.clientHeight-145;
Frt=InputBox.getBoundingClientRect().top+InputBox.clientHeight-130;
if (((Frl+Frw+Frs)>Winw)&&(Frw+Frs<Winw))
Frl=Winw-Frw-Frs;
if ((Frt+Frh+Frs>Winh)&&(Frh+Frs<Winh))
Frt=Winh-Frh-Frs;
document.all.Calendar1.style.display="";
document.all.Calendar1.style.left=Frl+25;
document.all.Calendar1.style.top=Frt; if (fw<2)
tf=fw+7;
else
tf=fw;
FrameContent+="<tr bgcolor='#FFFFFF'>"+"\n";
for (l=(ld-tf+2);l<=ld;l++)
{
FrameContent+="<td onclick=\"ForwardMonth(window.document.all."+InputBox.name+","+Now_Year+","+Now_Month+","+l+")\" style='cursor:hand'><center><font color='#BBBBBB'>"+l+"</font></center></td>"+"\n";
w++;
}
for (f=tf;f<=7;f++)
{
if (((w%7)==0)&&(d!=Now_Day))
FrameContent+="<td onMouseOver=\"this.style.background=\'#E1E1E1\'\" onMouseOut=\"this.style.background=\'#FFFFFF\'\" onClick=\"InputValue(window.document.all."+InputBox.name+","+Now_Year+","+Now_Month+","+d+");HiddenCalendar()\"style='cursor:hand'><center><font color='#FF0000'>"+d+"</font></center></td>"+"\n";
else if (d==Now_Day)
FrameContent+="<td style=\"background:#420042;cursor:hand\" onClick=\"InputValue(window.document.all."+InputBox.name+","+Now_Year+","+Now_Month+","+d+");HiddenCalendar()\"><center><font color='#FFFFFF'>"+d+"</font></center></td>"+"\n";
else
FrameContent+="<td onMouseOver=\"this.style.background=\'#E1E1E1\'\" onMouseOut=\"this.style.background=\'#FFFFFF\'\" onClick=\"InputValue(window.document.all."+InputBox.name+","+Now_Year+","+Now_Month+","+d+");HiddenCalendar()\" style='cursor:hand'><center>"+d+"</center></td>"+"\n";
d++;
w++;
}
FrameContent+="</tr>"+"\n";
w=1;
for (i=2;i<7;i++)
{
FrameContent+="<tr bgcolor='#FFFFFF'>"+"\n";
for (j=1;j<8;j++)
{
if (isnd)//
FrameContent+="<td style='cursor:hand' onclick=\"NextMonth(window.document.all."+InputBox.name+","+Now_Year+","+Now_Month+","+d+")\"><center><font color='#BBBBBB'>"+d+"</font></center></td>"+"\n";
else//
{
if (((w%7)==0)&&(d!=Now_Day))
FrameContent+="<td onMouseOver=\"this.style.background=\'#E1E1E1\'\" onMouseOut=\"this.style.background=\'#FFFFFF\'\" onClick=\"InputValue(window.document.all."+InputBox.name+","+Now_Year+","+Now_Month+","+d+");HiddenCalendar()\" style='cursor:hand'><center><font color='#FF0000'>"+d+"</font></center></td>"+"\n";
else if (d==Now_Day)
FrameContent+="<td style=\"background:#420042;cursor:hand\" onClick=\"InputValue(window.document.all."+InputBox.name+","+Now_Year+","+Now_Month+","+d+");HiddenCalendar()\"><center><font color='#FFFFFF'>"+d+"</font></center></td>"+"\n";
else
FrameContent+="<td onMouseOver=\"this.style.background=\'#E1E1E1\'\" onMouseOut=\"this.style.background=\'#FFFFFF\'\" onClick=\"InputValue(window.document.all."+InputBox.name+","+Now_Year+","+Now_Month+","+d+");HiddenCalendar()\" style='cursor:hand'><center>"+d+"</center></td>"+"\n";
}
//
if (d==td)
{
isnd=true;
d=0;
}
w++;
d++;
}
FrameContent+="</tr>"+"\n";
}
FrameContent+="</table>"+"\n";
InputValue(InputBox,Now_Year,Now_Month,Now_Day);document.all.Calendar1.innerHTML=FrameContent;
document.all.Calendar1.style.display="";
}
function DateBox(sBoxName, sDfltValue)
{
if (sBoxName==null)
sBoxName='Date_Box'
if ((sDfltValue==null)||!(DateIsTrue(sDfltValue)))
sDfltValue= GetTodayDate()
else
{
DateStr = sDfltValue.split("-");
Y= parseFloat(DateStr[0]);
M=(parseFloat(DateStr[1])<10)?('0'+parseFloat(DateStr[1])):parseFloat(DateStr[1]);
D=(parseFloat(DateStr[2])<10)?('0'+parseFloat(DateStr[2])):parseFloat(DateStr[2]);
sDfltValue=Y+'-'+M+'-'+D
}
document.write("<input size='10' readonly class='inputdate' name='"+sBoxName+"' value='"+sDfltValue+"' onclick='GetCalendar(window.document.all."+sBoxName+")' >");
}
document.onclick = CloseCalendar;
孟子大哥,我也是沒辦法呀,原因請看http://community.csdn.net/Expert/topic/3444/3444703.xml?temp=.9802973
如能解決那個問題那就不用轉換了,請幫個忙,謝了