当前位置:编程学习 > asp >>

“javascript做的日历”改进版

这是对原日历控件做了改进,始之更符合中国人的习惯。改进后的代码如下面,将其存为rl.asp然后在需要调用的文件中加入<!--#INCLUDE file="rl.asp" -->,在控件中的调用如下,主要为onfocus和onblur事件<input name="gcrq" type="text" id="gcrq" value="<%=date(now)%>" onFocus="CreateMonthView(this)" onBlur="DeleteMonthView(this)">
rl.asp主要内容
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<Script language="javascript">
<!--
//this is jsMonthView 1.0, author is Chinese DengKang (2002-07-12).
//I allow your do any modify, but i don't bear any liability.
//browser: IE 4 and later
function DefineMonthView(theTextObject){ //the month view construct function
this.GetOnlyName = function( ){ //create one and only name on the document
var theName = "MV"; //prefix
var aryName = new Array();
aryName[0] = "_MonthView"; //the month view main body's name postfix
aryName[1] = "_MonthGrid"; //the month view day area's name postfix
aryName[2] = "_goPreviousMonth"; //the month view go previous month button's name postfix
aryName[3] = "_goNextMonth"; //the month view go next month button's name postfix
aryName[4] = "_YearList"; //the month view year list's name postfix
aryName[5] = "_MonthList"; //the month view month list's name postfix
aryName[6] = "_DayList"; //keep the month view current day's element name postfix
var i = -1, j = 0, maxi = 2000;
var exTag = true;
while ((exTag == true) && (i < maxi)){
i++;
exTag = false;
for (j=0;j<aryName.length;j++){
if (document.all.item(theName + i.toString() + aryName[j]) != null){
exTag = true;
}
}
补充:asp教程,客户端相关打印 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,