温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:星幻短信群发平台Web源码
当前文件路径:XingHuanWebSms/js/calendar.htm

1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 2
<HTML><HEAD> 3
<META http-equiv=Content-Type content="text/html; charset=gb2312"> 4
<STYLE type=text/css>TD { 5
FONT-SIZE: 12px; FONT-FAMILY: arial; TEXT-ALIGN: center 6
} 7
TD.dt { 8
FONT-SIZE: 11px; FONT-FAMILY: arial; TEXT-ALIGN: center 9
} 10
A { 11
COLOR: blue 12
} 13
A:hover { 14
COLOR: red 15
} 16
A.bt { 17
COLOR: #888888 18
} 19
</STYLE> 20
21
<SCRIPT language=javascript> 22
<!--// 23
var str='',i,j,yy,mm,oFont,callback; 24
var oInputname,oStartdate; 25
var wp=window.parent; 26
var cf=wp.document.getElementById("CalFrame"); 27
var fld,curday,sd,ed,today=new Date(); 28
var n_position,n_textdate,startdate,enddate,vailidday,oddeven,vailiddate,objecttype,mmm,ddd,thirdfocus; 29
mmm=""; 30
today.setHours(0);today.setMinutes(0);today.setSeconds(0);today.setMilliseconds(0); 31
//var lastyear=today.getYear(),lastmonth=today.getMonth(); 32
33
function parseDate(s)//解析日期 34
{ 35
var reg=new RegExp("[^0-9-]","") 36
if(s.search(reg)>=0)return today; 37
var ss=s.split("-"); 38
if(ss.length!=3)return today; 39
if(isNaN(ss[0])||isNaN(ss[1])||isNaN(ss[2]))return today; 40
return new Date(parseFloat(ss[0]),parseFloat(ss[1])-1,parseFloat(ss[2])); 41
} 42
function resizeCalendar(){cf.width=144;cf.height=192;}//设定日历宽高 43
function initCalendar()//初始化 44
{ 45
curday=today; 46
if(oInputname&&oInputname.value.length>0){curday=parseDate(oInputname.value);} 47
if(oStartdate&&oStartdate.value.length>0){curday=parseDate(oStartdate.value);} 48
if (!startdate==""){sd=parseDate(startdate)} 49
if (!enddate==""){ed=parseDate(enddate)} 50
//window.alert(startdate); 51
//window.alert(enddate); 52
drawCalendar(curday.getFullYear(),curday.getMonth()); 53
} 54
function drawCalendar(y,m)//画日历? 55
{ 56
var x=new Date(y,m,1),mv=x.getDay(),d=x.getDate(),de; 57
yy=x.getFullYear();mm=x.getMonth(); 58
document.getElementById("yyyymm").innerHTML=yy+"."+(mm+1>9?mm+1:"0"+(mm+1)); 59
//清空日历 60
for(var i=1;i<=mv;i++) 61
{ 62
de=document.getElementById("d"+i); 63
de.innerHTML=""; 64
de.bgColor=""; 65
} 66
//画日历 67
while(x.getMonth()==mm) 68
{ 69
de=document.getElementById("d"+(d+mv)); 70
if(x.getTime()==curday.getTime()) 71
de.bgColor="#dddddd"; 72
else 73
de.bgColor="#DEF1F8"; 74
if(x.getTime()==today.getTime()) 75
{ 76
//window.alert(1); 77
if(ifDraw(x)) 78
{ 79
de.innerHTML="<a href=javascript:setDate("+d+");><font color=red>"+d+"</font></a>"; 80
} 81
else 82
{ 83
de.innerHTML="<font color=#ff0000>"+d+"</font>"; 84
} 85
86
87
} 88
//else if(x.getTime()<today.getTime()) 89
//{ 90
91
92
//window.alert(2); 93
//if(ifDraw(x)) 94
//{ 95
//if(oFont){de.innerHTML="<a href=javascript:setDate("+d+"); class=bt>"+d+"</a>";} 96
//else{de.innerHTML="<font color=#888888>"+d+"</font>";} 97
//} 98
//else 99
//{ 100
//de.innerHTML="<font color=#888888>"+d+"</font>"; 101
//} 102
//} 103
else 104
{ 105
106
//window.alert(3); 107
if(ifDraw(x)) 108
{ 109
de.innerHTML="<a href=javascript:setDate("+d+");>"+d+"</a>"; 110
} 111
else 112
{ 113
de.innerHTML="<font color=#888888>"+d+"</font>"; 114
} 115
116
117
} 118
x.setDate(++d); 119
} 120
while(d+mv<=42) 121
{ 122
de=document.getElementById("d"+(d+mv)); 123
de.innerHTML=""; 124
de.bgColor=""; 125
d++; 126
} 127
} 128
function ifDraw(xd) 129
{ 130
if(!startdate==""&&!enddate=="") 131
{ 132
133
if(xd.getTime()>=sd.getTime()&&xd.getTime()<=ed.getTime()) 134
{ 135
136
if(returnOE(xd)&&returnVD(xd)&&returnVDE(xd)) 137
{ 138
return true 139
} 140
else 141
{ 142
return false 143
} 144
} 145
else 146
{ 147
return false; 148
} 149
} 150
else 151
{ 152
if(returnOE(xd)&&returnVD(xd)&&returnVDE(xd)) 153
{ 154
return true 155
} 156
else 157
{ 158
return false 159
} 160
161
} 162
} 163
function returnOE(xd) 164
{ 165
if(!oddeven=="") 166
{ 167
if(oddeven=="0") 168
{ 169
if(xd.getDate()%2==0) 170
{ 171
return true; 172
} 173
else 174
{ 175
return false; 176
} 177
} 178
else 179
{ 180
if(!(xd.getDate()%2==0)) 181
{ 182
return true; 183
} 184
else 185
{ 186
return false; 187
} 188
} 189
190
} 191
else 192
{ 193
return true; 194
} 195
} 196
function returnVD(xd) 197
{ 198
if(!vailidday=="") 199
{ 200
if(vailidday.indexOf(xd.getDay().toString())>=0) 201
{ 202
return true; 203




FONT-SIZE

TD.dt 