日期:2013-12-15  浏览次数:20954 次

使用的是一个img作为按钮,一个iframe载入日期页面
<IMG id="ImgDate" style="LEFT: 137px; CURSOR: hand; POSITION: absolute; TOP: 1px" onclick="SetlstDate1Visible('TxtDate')" src=http://www.163design.net/a/y/"images/ImgBtn/frmMainDate.gif" width="21">

<IFRAME class="dtpMonth1" id="lstDate1" style="DISPLAY: none; Z-INDEX: 105; LEFT: 112px; WIDTH: 176px; POSITION: absolute; TOP: 152px; HEIGHT: 160px"
tabIndex="-1" name="lstDate1" src="frmDate.aspx" frameBorder="0" scrolling="no">
</IFRAME>

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="frmDate.aspx.vb" Inherits="MOST_WEB.frmDate"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>dtpDate1</title>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<meta content="Microsoft Visual Studio .NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="Styles.css" type="text/css" rel="stylesheet">
<script language="javascript" src="comFuncs.js"></script>
<script language="JavaScript">
function RunNian(The_Year)//取得是否為潤年
{
if ((The_Year%400==0) || ((The_Year%4==0) && (The_Year%100!=0)))
return true;
else
return false;
}

function GetWeekday(The_Year,The_Month)
{

var Allday;
Allday = 0;
if (The_Year>2000)
{
for (i=2000 ;i<The_Year; i++) //計算從2000年開始到今年的天數
{
if (RunNian(i)){
Allday += 366;
}else{
Allday += 365;
}
}

for (i=2; i<=The_Month; i++)
{
switch (i)
{
case 2 : Allday += 31; break;
case 3 :
if (RunNian(The_Year)){
Allday += 29;
}else{
Allday += 28;
}
break;
case 4 : Allday += 31; break;
case 5 : Allday += 30; break;
case 6 : Allday += 31; break;
case 7 : Allday += 30; break;
case 8 : Allday += 31; break;
case 9 : Allday += 31; break;
case 10 : Allday += 30; break;
case 11 : Allday += 31; break;
case 12 : Allday += 30; break;
}
}
}
return (Allday+6)%7;
}

function chooseday(objName,The_Year,The_Month,The_Day)
{
var Firstday;
Firstday = GetWeekday(The_Year,The_Month);//取得星期幾
ShowCalender(objName,The_Year,The_Month,The_Day);
}

function showdate(objName,The_Year,The_Month,The_Day){//顯示日期,將所選的日期傳到textbox中顯示出來
var txtDate;
objName="TxtDate";
txtDate= objName;

var completely_date;
var cur_Month
var cur_Day
if (The_Month.toString().length==1){//給月前面加0
cur_Month="0"+The_Month
}else{
cur_Month=The_Month
}
if (The_Day.toString().length==1){//給日期前加0
cur_Day="0"+The_Day
}else{
cur_Day=The_Day
}
if (The_Day!=0)//調整日期的樣式
completely_date = The_Year + "/" + cur_Month + "/" + cur_Day;
else
completely_date = "No Choose";

parent.document.al