⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calendar_c.htm

📁 1 除掉了 时间 限制 2 除掉了 人数 限制 改为 500人 原为5人 3 发现一点小缺陷 增加人员的时候没有判断 登陆名是否重复! 自己写吧~~~:) 4 又 是一点缺陷
💻 HTM
字号:
<html>
<head>
<LINK href="../global.css" rel=stylesheet type=text/css>
<title>日历</title>

<script language=javascript>
function Check_Num(checkstr)
         {
           var chtxt;
           
           for (var i = 0; i < checkstr.length; i++)
           {
             chtxt = checkstr.substring(i, i + 1);
             if ((chtxt < "0" || chtxt > "9") && (chtxt!="."))
             {
                 return false;
             }
           }
           return true;
          }
function toOpenWindow(theForm,theName)
{
	var theWindow;
	var theAccount;
	theWindow = window.open("../common/PickWindow.asp?theForm="+theForm+"&theName="+theName,"PickWindow","toolbar=no,scrollbars=yes,location=no,status=no,menubar=no,width=520,height=320,top=150,left=160");
	theWindow.opener = this;
}

//有些pickwindow是不需要提交母窗口的,比如用户名、产品等等
function toOpenWindowNew(theForm,theName,bChange)
{
	var theWindow;
	var theAccount;
	theWindow = window.open("../common/PickWindow.asp?theForm="+theForm+"&theName="+theName+"&bChange="+bChange,"PickWindow","toolbar=no,scrollbars=yes,location=no,status=no,menubar=no,width=520,height=320,top=150,left=160");
	theWindow.opener = this;
}

//for PriceAccount
function toOpenWindowPriceAccount(theForm,theName,bChange,AccountCondition)
{
	var theWindow;
	var theAccount;
	theWindow = window.open("../common/PickWindow.asp?theForm="+theForm+"&theName="+theName+"&bChange="+bChange+"&AccountCondition="+AccountCondition,"PickWindow","toolbar=no,scrollbars=yes,location=no,status=no,menubar=no,width=520,height=320,top=150,left=160");
	theWindow.opener = this;
}
//for QuoteAccount
function toOpenWindowQuoteAccount(theForm,theName,bChange,QuoteAccount)
{
	var theWindow;
	var theAccount;
	theWindow = window.open("../common/PickWindow.asp?theForm="+theForm+"&theName="+theName+"&bChange="+bChange+"&QuoteAccount="+QuoteAccount,"PickWindow","toolbar=no,scrollbars=yes,location=no,status=no,menubar=no,width=520,height=320,top=150,left=160");
	theWindow.opener = this;
}
//解决pickwindow不触发onchange事件,for Transaction
function toOpenWindowTransaction(theForm,theName,Warehouse,bChange)
{
	var theWindow;
	var theAccount;
	theWindow = window.open("../common/PickWindow.asp?theForm="+theForm+"&theName="+theName+"&bChange="+bChange+"&Warehouse="+Warehouse,"PickWindow","toolbar=no,scrollbars=yes,location=no,status=no,menubar=no,width=520,height=320,top=150,left=160");
	theWindow.opener = this;
}

//解决pickwindow不触发onchange事件,for Price
function toOpenWindowPrice(theForm,theName,tablename,fieldname,tdid,bChange)
{
	var theWindow;
	var theAccount;
	theWindow = window.open("../common/PickWindow.asp?theForm="+theForm+"&theName="+theName+"&bChange="+bChange+"&tablename="+tablename+"&fieldname="+fieldname+"&tdid="+tdid,"PickWindow","toolbar=no,scrollbars=yes,location=no,status=no,menubar=no,width=520,height=320,top=150,left=160");
	theWindow.opener = this;
}

function toOpenWindow4Order(theForm,theName,bChange,count,Flag)
{
	theWindow = window.open("../common/PickWindow.asp?theForm="+theForm+"&theName="+theName+"&bChange="+bChange+"&NoFlag="+Flag+"&count="+count,"PickWindow","toolbar=no,scrollbars=yes,location=no,status=no,menubar=no,width=520,height=320,top=150,left=160");
	theWindow.opener = this;
}

function check_decimal(input,x1,x2)
{
	var d1 = "";
	d1 = input;
	d1 = d1.split(".");
	if ((d1[0]>=Math.pow(10,x1-x2)) || (d1[1]>=Math.pow(10,x1)))
	{
		return (1);
	}
	else 
	{
		return (0);
	}
}	

function check_time(input)
{
	var t1 = "";
	t1 = input;
	t1 = t1.split(":");
	//alert('t1[0] is '+t1[0]+' t1[1] is '+t1[1]);
	if ((t1[0]>24)||(t1[1]>60))
	{
		return (1);
	}
	else
	{
		return (0);
	}
}

function check_date(input)
{
	var d1 = "";
	d1 = input;
	d1 = d1.split("-");
	//alert('d1[0] is '+d1[0]+' d1[1] is '+d1[1]+'d1[2] is '+d1[2]);
	
	if ((input=="FINISH")||(input=="NOFINISH")||(input=="TODAY")||(input=="YESTERDAY")||(input=="TOMORROW")||(input=="LAST WEEK")||(input=="THIS WEEK")||(input=="NEXT WEEK")||(input=="LAST MONTH")||(input=="THIS MONTH")||(input=="NEXT MONTH")) return (0);
	if ((d1[1]>0) && (d1[1]<13) && (d1[2]<32) && (d1[2]>0)) 
	{
		 if (
				!(d1[1]==2 && d1[2]==31) && 
				!(d1[1]==2 && d1[2]==30) &&
				!(d1[1]==4 && d1[2]==31) && 
				!(d1[1]==6 && d1[2]==31) && 
				!(d1[1]==9 && d1[2]==31) && 
				!(d1[1]==11 && d1[2]==31)&&
				!( !( ((d1[0] %4==0) && !(d1[0] %100==0)) || (d1[0] % 400 ==0)) && (d1[1]==2) && (d1[2]==29))
			) 
		{
			return (0);
		}
		else 
		{
			return (1);
		}
	}
	else
	{
		return (1);
	}
}			
themonth = 0;
theyear = 0;

theMonths = new MakeArray(12);
// load array with one object for each month
theMonths[1] = new aMonth("一月",31,0);
theMonths[2] = new aMonth("二月",28,1);
theMonths[3] = new aMonth("三月",31,2);
theMonths[4] = new aMonth("四月",30,3);
theMonths[5] = new aMonth("五月",31,4);
theMonths[6] = new aMonth("六月",30,5);
theMonths[7] = new aMonth("七月",31,6);
theMonths[8] = new aMonth("八月",31,7);
theMonths[9] = new aMonth("九月",30,8);
theMonths[10] = new aMonth("十月",31,9);
theMonths[11] = new aMonth("十一月",30,10);
theMonths[12] = new aMonth("十二月",31,11);
var firstDay = 0;
var howMany = 0;

//这个函数已经没用了, by hekai, 2002-7-23
//现在换了一个准确的函数,直接通过点击每个日期的小框,调用返回日期。
/*
function Clicktable()
{
	var cX = event.clientX - 14;
	var cY = event.clientY - 110;
 	var thecolumn= parseInt(cX/30);
	var therow = parseInt(cY/26);
   	var clicked=therow*7 + thecolumn;
   //	window.alert(cX);
  // alert('row is '+therow+' col is '+thecolumn);
 //   alert('column is '+thecolumn+' the row is '+therow);
	
		var tempwin=window.opener;
		
		if(!tempwin.closed)
		{   
			var clicked15=parseInt(clicked -firstDay +8);
			
			var myDate
			if (cY < 0)
			   { myDate = theyear+'-'+(themonth + 1)+'-'+(clicked -firstDay +1);}
			else   
			   { myDate = theyear+'-'+(themonth + 1)+'-'+(clicked -firstDay +8);}
			//window.opener.clicksource.focus();
			if (check_date(myDate)!=1) {
			window.opener.form1.clickresult.value = myDate;
			window.opener.returndate();
			}
		}
	
		if (check_date(myDate)!=1) window.close();
		//alert(theyear+'-'+(themonth+1)+'-'+(clicked - firstDay + 1));

}
*/

function ReturnDate(day)
{
		var tempwin=window.opener;
		
		if(!tempwin.closed)
		{   

			var myDate
		    myDate = theyear+'-'+(themonth + 1)+'-'+day;
			
			//alert(myDate);
			//window.opener.clicksource.focus();
			if (check_date(myDate)!=1) {
			window.opener.form1.clickresult.value = myDate;
			window.opener.returndate();
			}
		}
	
		if (check_date(myDate)!=1) window.close();

}

function pretable()
{
	var oneField;
	oneField = "<INPUT TYPE='text' NAME='oneDay' SIZE=2 onFocus='' onClick='ReturnDate(this.value);'>";
	// start assembling HTML for raw table
	var content = '';
	// field for month and year display at top of calendar

	// days of the week at head of each column
	content += "<TR class=dark5><TH><font color=black>日</font></TH><TH><font color=black>一</font></TH><TH><font color=black>二</font></TH><TH><font color=black>三</font></TH>";
	content += "<TH><font color=black>四</font></TH><TH><font color=black>五</font></TH><TH><font color=black>六</font></TH></TR>";
	content += "<TR>";

	// layout 6 rows of fields for worst-case month
	for (var i = 1; i < 43; i++) 
	{
		
		content += "<TD>" + oneField + "</TD>";
		if(i == 42)
		{
			content +="</TR></table></span></td></tr>";
		}
		else if (i % 7 == 0) 
		{
			content += "</TR><TR>";
		}
		
		if(i==35)
		{
			content +='<td colspan=7><div id = Lastline style="display:none"><table><tr>';
		}
	}
	//content +='</div>'
	//content += "</tr></TABLE></form>"
	// blast empty table to the document
	document.write(content);
}

function getFebLength(theYear) {
	theYear = (theYear < 1900) ? theYear + 1900: theYear
	if ((theYear % 4 == 0 && theYear % 100 != 0) || theYear % 400 == 0) {
		return (29);
	}
	return (28);
}
function getFirstDay(theYear){
	var firstDate = new Date(theYear,this.offset,1);
	return firstDate.getDay();
}
// month object constructor
function aMonth(name,length,offset) {
	this.name = name; // used in calendar display
	this.length = length; // used for knowing how many days to display
	this.offset = offset; // used as an index value
	this.getFirstDay = getFirstDay; // method, defined above
}

function MakeArray(n){
	this.length = n;
	return this;
}

function writetable(){
	// initialize variables for later from user selections
	//var theMonth = form.chooseMonth.options[form.chooseMonth.selectedIndex].text
	//var theYear = form.chooseYear.options[form.chooseYear.selectedIndex].text
	// initialize date-dependent variables
	//var anchorDay = new Date(theYear-1900,form.chooseMonth.selectedIndex,1)
	var anchorDay = new Date(theyear,themonth,1);
	var monthOffset = anchorDay.getMonth() + 1;
	if (monthOffset == 2) {
		theMonths[2].length = getFebLength(anchorDay.getYear());
	}
	firstDay = theMonths[monthOffset].getFirstDay(anchorDay.getYear());
	howMany = theMonths[monthOffset].length;
	// set month and year in top field
	
	// fill fields of table
	if( howMany+firstDay > 35 )
	{
		Lastline.style.display = "";
		//alert(form3.text)
	}
	else
		 Lastline.style.display = "none";
	for (var i = 0; i < 42; i++) {
		if (i < firstDay || i >= (howMany + firstDay)) {
			// before and after actual dates, empty fields
			// address fields by name and [index] number
			form2.oneDay[i].value = "";
		} else {
			// enter date values
			form2.oneDay[i].value = i - firstDay + 1;
		}
	}
}
// end -->


function monthchange(change)
{
	if((change!=1 && change!=-1) || themonth>11 || themonth<0)
	{
		var dateObj = new Date();
		//alert(dateObj);
		themonth=dateObj.getMonth();
		month.value= theMonths[ themonth + 1].name;
	}
	{
		if (themonth==11&&change==1)
		{
			themonth = 0;
		}
		else if(themonth==0&&change==-1)
		{
			themonth=11;
		}
		else
		{
			//alert(.monthno.value);
			themonth += change ;
			
		}
		month.value = theMonths[ themonth + 1].name;
	}

}

function yearchange(change)
{
	if((change!=1 && change!=-1) || theyear < 1900)
	{
		var dateObj = new Date();
		
		theyear= dateObj.getYear();
		form1.year.value = theyear;
	}
	else
	{
		theyear += change;
		year.value = theyear;
	}
}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../global.css" rel=stylesheet type=text/css>
</head>
<body bgcolor="#FFFFFF" text="#000000" >
<div align="center">
  <table width=90% cellpadding="0" cellspacing="0" border=0 bgcolor="#FFFFFF">
    <tr border=0>
		<td align=left width=80% bgcolor="#333399" colspan="3"><strong><font color="#FFFFFF" face="宋体" size="2">选择日期</font></strong></td>
		<td align=right bgcolor="#333399"><a onClick="window.close();"><font font-size: 8pt color="#9999FF" face="宋体" size="2" style="cursor:hand">关闭</font></strong></a></td>
	</tr>
	<tr class=dark2>
		<td align=left bgcolor="#CCCCFF" height=20 colspan="4"><strong><font face="宋体" size="3" color="#000000">
		<input disabled type =text name=month size="6" maxlength="14">&nbsp;<input disabled type=text name=year size="6"></font></strong></td>
	</tr>
	<tr align="center" valign="middle" bgcolor="#ffffff"> 
      <td width=25% height="20"><a href="javascript:yearchange(-1);writetable();"><img src="../images/year1.gif" border=0 width="38" height="12"></a></td>
		
      <td width=25% height="20"><a href="javascript:monthchange(-1);writetable();"><img src="../images/month1.gif" border=0 width="29" height="12"></a></td>
		
      <td width=25% height="20"><a href="javascript:monthchange(1);writetable();"><img src="../images/month2.gif" border=0 width="29" height="12"></a> 
      <td width=25% height="20"><a href="javascript:yearchange(1);writetable();"><img src="../images/year2.gif" border=0 width="38" height="12"></a> 
    </tr>
</table>
<TABLE name=daytable1 border=0  language=javascript bgcolor=CCCCFF>
<FORM name=form2>
<script language=javascript>
//calendar1.isTextEdit = false;
//.year.isTextEdit = false;
	var dateObj= new Date();
	themonth = dateObj.getMonth();
	month.value= theMonths[ themonth + 1].name;

	theyear = dateObj.getYear();
	year.value = theyear;
	pretable();
	writetable();
	//alert('show last line');
	//Lastline.style.visiblity = none;
	//alert(content);
	//daytable.onClick=clicktable();
</script>
</form>
</table>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -