1. 急求旅游网日历插件Calendar.js使用
大概是你设置错了。
注意下图中红色标示的部分!
默认显示的年、月要在说设定的最早时间和最晚时间之间。
2. 在js日历控件中如何把月和日小于10的自动在前面添加0
自定义过滤器
{{a| xxx}}
Vue.filter('xxx',function(aa){
return aa<10?'0'+aa:''+aa;
})
xxx是过滤器的名字
aa 是过滤的那个数据
如果那个数据小于10,则在他前面添加一个0
比如
过滤数据是 9
过滤后变成 09
我用的是vue,逻辑就是这样
微信小程序日历组件calendar详解及实例
模版使用:
src="../cal/calendar.wxml">
is="calendar"
data="{{selected_value,days,month,years,lunar_years,lunar_month,lunar_days,selectDateType,l
unar_selected_value}}">
JS代码使用:
var
Calendar
=
require('../cal/calendar');
Page({
data:
{
selected_value:
[],
days:
[],
month:
[],
years:
[],
lunar_years:
[],
lunar_month:
[],
lunar_days:
[],
selectDateType:
1,
lunar_selected_value:
[]
},
....
//
指定选择器回调函数
new
Calendar('key',
this,
function(date){
that.setData({
date:
date
})
});
样式
.calendar{
position:
absolute;
bottom:
0;
width:
100%;
z-index:
999;
background-color:
#fff;
}
.tab{
display:inline-block;
width:50%;
text-align:center;
font-size:16px;
color:
#ccc;
}
.tab-bar{
background-color:
#eee;
height:
40px;
line-height:
40px;
}
.tab-bar
.active{
color:
#000;
}
.selected-item{
font-size:
28px;
}
.event-type_parent{
font-size:
14px;
}
.event-type_child{
text-align:
center;
line-height:
30px;
}
.event-type_txt{
display:
inline-block;
}
以上用法看不懂的话,具体就参考代码里面index目录下。
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
4. JS的日历控件的日期格式,输出已经改成YYYY/MM/DD了,但是传入的时候不能识别,求懂的朋友指点
传入时用标准的,YYYY-MM-DD,如果用/分隔符,需要符合美式或英式写法:最后一项内是容年。MM/DD/YYYY, 或DD/MM/YYYY
YYYY/MM/DD, 常规来说,没这种写法。如果是年月日,通常采用"-"做分隔符。
5. 下载了一个JS日历的代码,但是全部都是由文本框点击弹出的!我不想要弹出效果,只想要弹出的日历那部分!
当点击Text1时会触发显示日历控件的事件。
所以如果你想不点击文本框就显示日历,可以在页面加载时调用calendar.show()
6. 求一款js做的时间日历控件
这是我找到的一个js做的日历,不知道是不是你要的,里面有包含时间,其实在日历里面加时间也是比较简单的,只要调用DATE的方法就可以了,希望对你有用。下面是代码段,效果图附上。
<html>
<head>
<SCRIPTLANGUAGE="javaScript"TYPE="text/javascript">
//定义月历函数
functioncalendar(){
vartoday=newDate();//创建日期对象
year=today.getYear();//读取年份
thisDay=today.getDate();//读取当前日
//创建每月天数数组
varmonthDays=newArray(31,28,31,30,31,30,31,31,30,31,30,31);
//如果是闰年,2月份的天数为29天
if(((year%4==0)&&(year%100!=0))||(year%400==0))monthDays[1]=29;
daysOfCurrentMonth=monthDays[today.getMonth()];//从每月天数数组中读取当月的天数
firstDay=today;//复制日期对象
firstDay.setDate(1);//设置日期对象firstDay的日为1号
startDay=firstDay.getDay();//确定当月第一天是星期几
//定义周日和月份中文名数组
vardayNames=newArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
varmonthNames=newArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
//创建日期对象
varnewDate=newDate();
//创建表格
document.write("<TABLEBORDER='0'CELLSPACING='0'CELLPADDING='2'ALIGN='CENTER'BGCOLOR='#0080FF'>")
document.write("<TR><TD><tableborder='0'cellspacing='1'cellpadding='2'bgcolor='#88FF99'>");
document.write("<TR><thcolspan='7'bgcolor='#C8E3FF'>");
//显示当前日期和周日
document.writeln("<FONTSTYLE='font-size:9pt;Color:#FF0000'>"+newDate.getYear()+"年"+monthNames[newDate.getMonth()]+""+newDate.getDate()+"日"+dayNames[newDate.getDay()]+"</FONT>");
//显示月历表头
document.writeln("</TH></TR><TR><THBGCOLOR='#0080FF'><FONTSTYLE='font-size:9pt;Color:White'>日</FONT></TH>");
document.writeln("<thbgcolor='#0080FF'><FONTSTYLE='font-size:9pt;Color:White'>一</FONT></TH>");
document.writeln("<THBGCOLOR='#0080FF'><FONTSTYLE='font-size:9pt;Color:White'>二</FONT></TH>");
document.writeln("<THBGCOLOR='#0080FF'><FONTSTYLE='font-size:9pt;Color:White'>三</FONT></TH>");
document.writeln("<THBGCOLOR='#0080FF'><FONTSTYLE='font-size:9pt;Color:White'>四</FONT></TH>");
document.writeln("<THBGCOLOR='#0080FF'><FONTSTYLE='font-size:9pt;Color:White'>五</FONT></TH>");
document.writeln("<THBGCOLOR='#0080FF'><FONTSTYLE='font-size:9pt;Color:White'>六</FONT></TH>");
document.writeln("</TR><TR>");
//显示每月前面的"空日"
column=0;
for(i=0;i<startDay;i++){
document.writeln("<TD><FONTSTYLE='font-size:9pt'></FONT></TD>");
column++;
}
//如果是当前日就突出显示(红色),否则正常显示(黑色)
for(i=1;i<=daysOfCurrentMonth;i++){
if(i==thisDay){
document.writeln("</TD><TDALIGN='CENTER'><FONTSTYLE='font-size:9pt;Color:#ff0000'><B>")
}
else{
document.writeln("</TD><TDBGCOLOR='#88FF99'ALIGN='CENTER'><FONTSTYLE='font-size:9pt;font-family:Arial;font-weight:bold;Color:#000000'>");
}
document.writeln(i);
if(i==thisDay)document.writeln("</FONT></TD>")
column++;
if(column==7){
document.writeln("<TR>");
column=0;
}
}
document.writeln("<TR><TDCOLSPAN='7'ALIGN='CENTER'VALIGN='TOP'BGCOLOR='#0080FF'>")
document.writeln("<FORMNAME='time'onSubmit='0'><FONTSTYLE='font-size:9pt;Color:#ffffff'>")
//显示当前时间
document.writeln("当前时间:<INPUTTYPE='Text'NAME='textbox'ALIGN='TOP'></FONT></TD></TR></TABLE>")
document.writeln("</TD></TR></TABLE></FORM>");
}
</SCRIPT>
<SCRIPTLANGUAGE="JavaScript">
//初始化控制变量
vartimerID=null;
vartimerRunning=false;
//定义时间显示函数
functionstoptime(){
if(timerRunning)
clearTimeout(timerID);
timerRunning=false;}
//定义显示时间函数
functionshowtime(){
varnewDate=newDate();
varhours=newDate.getHours();
varminutes=newDate.getMinutes();
varseconds=newDate.getSeconds()
vartimeValue=""+((hours>12)?hours-12:hours)
timeValue+=((minutes<10)?":0":":")+minutes
timeValue+=((seconds<10)?":0":":")+seconds
timeValue+=(hours>=12)?"下午":"上午"
document.time.textbox.value=timeValue;
timerID=setTimeout("showtime()",1000);//设置超时,使时间动态显示
timerRunning=true;}
//显示当前时间
functionstarttime(){
stoptime();
showtime();}
</SCRIPT>
</head>
<BODYonLoad="starttime()"TEXT="#000000"TOPMARGIN="0">
<scriptlanguage="JavaScript"type="text/javascript">
calendar();//显示月历
</script>
</BODY>
</html>
7. 怎么让日历控件中当天之前的日期变成灰色并且不能选,我用的是My97DatePicker JS时间控件
1、首先新建个html文件喽,再用编辑器打开文件开始编写代码。