仓酷云
标题:
ASP网站制作之Javascript+HTML仿制VB里的MonthView控...
[打印本页]
作者:
爱飞
时间:
2015-1-16 22:30
标题:
ASP网站制作之Javascript+HTML仿制VB里的MonthView控...
缺点:安全性不是太差了,还行,只要你充分利用系统自带的工具;唯一缺点就是执行效率慢,如何进行网站优化以后,效果会比较好。<html>
<head>
<title>MonthViewDemo</title>
<scriptlanguage=javascript>
/***********************************程序功效:日期选择
特性 :Javascript+HTML仿制VB里的MonthView控件
作者 :ken
接洽 :boboshu@21cn.com
开辟日期:2002-8-5
***********************************/
varlanguageName="cn"//内容显现的言语value:"cn""en"
varcurrentMonth,currentYear
varnowDate,nowMonth,nowYear
d=newDate();
nowDate=d.getDate()
nowMonth=d.getMonth()
nowYear=d.getYear()
currentMonth=nowMonth
currentYear=nowYear
arrWeekCaption_cn=newArray("日曜日","礼拜一","礼拜二","礼拜三","木曜日","礼拜五","礼拜六")
arrWeekCaption_en=newArray("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
arrMonthCaption_cn=newArray("一月","仲春","三月","四月","蒲月","六月","七月","八月","玄月","十月","十一月","十仲春")
arrMonthCaption_en=newArray("January","February","March","April","May","June","July","August","September","October","November","December")
functionMonthView(){}
/*******************************初始化控件
*******************************/
functionMonthView.initialize(){
output=<tablecellpadding=0cellspacing=2style="border:1solidblack;width:300;cursor:default"id="tblMonthView"onselectstart="returnfalse">
output+=<tr>
output+=<td>
output+=<tablewidth="100%"cellpadding=0cellspacing=0>
output+=<trstyle="padding-top:10;padding-bottom:10;background:menu;"id="trCaption">
output+=<td><inputtype="button"value="3"style="height:22;font-family:webdings"></td>
output+=<tdalign="center"><spanid="spanCurrentMonth"style="font-size:12;"></span><spanstyle="padding-left:10;font-size:12"id="spanCurrentYear"></span></td>
output+=<tdalign="right"><inputtype="button"value="4"style="height:22;font-family:webdings"></td>
output+=</tr>
output+=</table>
output+=</td>
output+=</tr>
output+=<tr>
output+=<td>
output+=<tablewidth="100%"cellpadding=0cellspacing=2id="tblShowDay"style="font-size:12">
output+=<tralign="center"><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
output+=<tr><tdcolspan=7height="1"style="background:black"id="tdLine"></td></tr>
output+=<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
output+=</table>
output+=</td>
output+=</tr>
output+=<tr>
output+=<td>
output+=<tablewidth="100%"cellpadding=0cellspacing=2id="tblToday"style="font-size:12">
output+=<tr><tdwidth="20"></td><td></td></tr>
output+=</table>
output+=</td>
output+=</tr>
output+=</table>
document.write(output)
//*********以后年、月的显现*********
MonthView.setCurrentCaption()
//*********************************
//*********礼拜表头的显现*********
MonthView.setWeekCaption()
//*********************************
//*********设置每个月的日期*********
MonthView.bulidDay()
//*****************************
//*********显现埋没昔日日期*********
MonthView.setShowHideToday(true)
//*****************************
}
functionMonthView.setCurrentCaption(){
spanCurrentYear.innerHTML=currentYear
if(languageName=="cn"){
spanCurrentMonth.innerHTML=arrMonthCaption_cn[currentMonth]
}else{
spanCurrentMonth.innerHTML=arrMonthCaption_en[currentMonth]
}
}
functionMonthView.setWeekCaption(){
if(languageName=="cn"){
arrCaption=arrWeekCaption_cn
}else{
arrCaption=arrWeekCaption_en
}
for(vari=0;i<arrCaption.length;i++){
tblShowDay.rows[0].cells[i].innerHTML=arrCaption[i]
}
}
functionMonthView.bulidDay(){
arrMonthCount=newArray(31,28,31,30,31,30,31,31,30,31,30,31)
if((currentYear%400==0)||((currentYear%100==0)&&(currentYear%4==0))){
arrMonthCount[1]=29
}
rowDay=2
while(tblShowDay.rows.length>rowDay){
tblShowDay.deleteRow(rowDay)
}
firstDay=newDate(currentYear,currentMonth,1)
tempRow=tblShowDay.insertRow()
//*********添补当月1号之前的日期*********
for(varj=0;j<firstDay.getDay();j++){
tempCell=tempRow.insertCell()
}
//*************************************
for(vari=1;i<=arrMonthCount[currentMonth];i++){
tempCell=tempRow.insertCell()
tempCell.style.textAlign="center"
tempCell.innerHTML=i
tempCell.onclick=MonthView.action
if((i+firstDay.getDay())%7==0&&i!=arrMonthCount[currentMonth]){tempRow=tblShowDay.insertRow()}
}
}
functionMonthView.showCurrentDate(direction){
if(direction=="preview"){
currentMonth--
if(currentMonth<0){currentMonth=11;currentYear--}
}
if(direction=="next"){
currentMonth++
if(currentMonth>11){currentMonth=0;currentYear++}
}
MonthView.setCurrentCaption()
MonthView.bulidDay()
}
functionMonthView.setLanguage(itsName){
languageName=itsName
MonthView.setCurrentCaption()
MonthView.setWeekCaption()
MonthView.setShowHideToday(true)
}
functionMonthView.setCaptionBg(itsColor){
trCaption.style.background=itsColor
}
functionMonthView.setBorder(itsBorder){
tblMonthView.style.border=itsBorder
}
functionMonthView.setLineColor(itsColor){
tdLine.style.background=itsColor
}
functionMonthView.setShowHideToday(flag){
el=tblToday.rows[0].cells[1]
if(flag){
if(languageName=="cn"){
el.innerHTML="昔日:"+nowYear+"-"+(nowMonth+1)+"-"+nowDate
}else{
el.innerHTML="Today:"+nowYear+"-"+(nowMonth+1)+"-"+nowDate
}
el.style.display="block"
}else{
el.style.display="none"
}
}
functionMonthView.action(){
//*********请修正此函数*********
MonthView_value=currentYear+"-"+(currentMonth+1)+"-"+this.innerHTML
alert(MonthView_value)
}
</script>
</head>
<body>
<div>
<scriptlanguage=javascript>
MonthView.initialize()
</script>
</div>
<br><br>
<tableborder=1style="font-size:12;width:95%">
<tr>
<td>办法</td><td>形貌</td><td>演示</td>
</tr>
<tr>
<td>MonthView.initialize()</td>
<td>初始化控件</td>
<td><imagesrc="http://edu.cnzz.cn/NewsInfo/none.gif"width="1"height="1"></td>
</tr>
<tr>
<td>MonthView.setLanguage(<i>par</i>)<br>参数:"cn""en"</td>
<td>设置控件显现言语</td>
<td>
<inputtype="button"value="中文">
<inputtype="button"value="英文">
</td>
</tr>
<tr>
<td>MonthView.setBorder(<i>par</i>)<br>参数:"边框宽度(int)边框外形(solid|dot...)边框色彩"</td>
<td>边框设置</td>
<td>
<inputtype="button"value="ChangeBorder">
</td>
</tr>
<tr>
<td>MonthView.setCaptionBg(<i>par</i>)<br>参数:十六进制色彩代码</td>
<td>设置以后年、月的背景致</td>
<td>
<inputtype="button"value="INFOBACKGROUND">
</td>
</tr>
<tr>
<td>MonthView.setLineColor(<i>par</i>)<br>参数:十六进制色彩代码</td>
<td>设置支解线的色彩</td>
<td>
<inputtype="button"value="Darkred">
</td>
</tr>
<tr>
<td>MonthView.setShowHideToday(<i>par</i>)<br>参数:true|false</td>
<td>显现/埋没昔日日期</td>
<td>
<inputtype="button"value="Hide">
<inputtype="button"value="Show">
</td>
</tr>
</table>
</body>
</html>
转自:静态网制造指南www.ckuyun.com使用filesystemobject,可以对服务器上的文件进行操作,浏览、复制、移动、删除等。有ado的支持,asp对数据库的操作非常得心应手。你甚至可以像使用本地数据库那样,管理远程主机上的数据库,对表格、记录进行各种操作。
作者:
精灵巫婆
时间:
2015-1-19 15:49
掌握asp的特性而且一定要知道为什么。
作者:
若相依
时间:
2015-1-26 19:16
Response:从字面上讲是“响应”,因此这个是服务端向客户端发送东西的,例如Response.Write
作者:
兰色精灵
时间:
2015-2-4 20:09
没有坚实的理论做基础,那么我们连踏入社会第一步的资本都没有,特别对于计算机专业的学生学好专业知识是置关重要的。在这里我侧重讲一下如何学习ASP,从平时的学习过程中。
作者:
海妖
时间:
2015-2-10 06:31
我想问如何掌握学习节奏(先学什么再学什么)最好详细点?
作者:
再现理想
时间:
2015-3-1 01:32
我们必须明确一个大方向,不要只是停留在因为学而去学,我们应有方向应有目标.
作者:
冷月葬花魂
时间:
2015-3-10 11:56
我们必须明确一个大方向,不要只是停留在因为学而去学,我们应有方向应有目标.
作者:
小女巫
时间:
2015-3-17 06:53
还有如何才能在最短的时间内学完?我每天可以有效学习2小时,双休日4小时。
作者:
飘灵儿
时间:
2015-3-24 00:36
没有坚实的理论做基础,那么我们连踏入社会第一步的资本都没有,特别对于计算机专业的学生学好专业知识是置关重要的。在这里我侧重讲一下如何学习ASP,从平时的学习过程中。
欢迎光临 仓酷云 (http://ckuyun.com/)
Powered by Discuz! X3.2