calendar.js(急求旅游网日历插件Calendar.js使用)
各位朋友,你是否对calendar.js和急求旅游网日历插件Calendar.js使用的相关问题感到好奇?别担心,我将为你揭示这些问题的答案,帮助你更好地理解和应用这些知识。让我们一起探索吧!
js中写东西控制Calendar在页面上显示默认日期怎么写啊
您好!
方法一:你可以把数据存入数据库,然后根据日期调用不用的价格;
方法二:在SQL里面写一个触发器,写在产品的价格表里面;
方法三:利用以下代码:
<%
m=month(now)
d=day(now)
if d< 10 then
d="0"&d
end if
date1=m&d
if cint(date1)> 1000 and cint(date1)< 1008 then
jiage="150"
else if cint(date1)> 1007 and cint(date1)< 1016 then
jiage="120"
else
jiage="100"
end if
end if
%>
把jiage这个变量引入表单就可以了,比楼上那一大段简单多啦;
方法四:如果你的时间变动是固定的,你就可以直接在该时间段内判断;如果不是的话,最好,设定三个字段,存不同时期产品的价格;
如:price1 100
price2 120
price3 150
页面上作一时间判断,然后根据时间的不同选取不同的价格;
你也可以到网管论坛看看吧!这里也许有专门针对你提出问题的解决办法:
另外,虚机团上产品团购,超级便宜
求jsp日历(calendar)代码,click后能选择周
package calendar;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
public class CalendarV2 extends Applet{
private boolean isStandalone= false;
//Get a parameter value
public String getParameter(String key, String def){
return isStandalone? System.getProperty(key, def):
(getParameter(key)!= null? getParameter(key): def);
}
//Construct the applet
public CalendarV2(){
}
//Initialize the applet
public void init(){
try{
jbInit();
}
catch(Exception e){
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception{
jLabel1.setText("Please Enter Year");
jLabel1.setBounds(new Rectangle(8, 30, 114, 26));
this.setLayout(null);
jTextField1.setText("");
jTextField1.setBounds(new Rectangle(129, 30, 136, 27));
jLabel2.setText("Please Ente Month");
jLabel2.setBounds(new Rectangle(4, 70, 104, 26));
jTextField2.setText("");
jTextField2.setBounds(new Rectangle(130, 69, 136, 26));
jButton1.setBounds(new Rectangle(16, 122, 233, 21));
jButton1.setText("CheckCalendarV2");
jButton1.addActionListener(new CalendarV2_jButton1_actionAdapter(this));
jButton2.setBounds(new Rectangle(16, 156, 232, 20));
jButton2.setText("Exit");
jButton2.addActionListener(new CalendarV2_jButton2_actionAdapter(this));
this.add(jButton1, null);
this.add(jTextField1, null);
this.add(jTextField2, null);
this.add(jLabel2, null);
this.add(jLabel1, null);
this.add(jButton2, null);
}
JLabel jLabel1= new JLabel();
JTextField jTextField1= new JTextField();
JLabel jLabel2= new JLabel();
JTextField jTextField2= new JTextField();
JButton jButton1= new JButton();
//Get Applet information
public String getAppletInfo(){
return"Applet Information";
}
//Get parameter info
public String[][] getParameterInfo(){
return null;
}
//Main method
public static void main(String[] args){
CalendarV2 applet= new CalendarV2();
applet.isStandalone= true;
Frame frame;
frame= new Frame();
frame.setTitle("Applet Frame");
frame.add(applet, BorderLayout.CENTER);
applet.init();
applet.start();
frame.setSize(400,320);
Dimension d= Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width- frame.getSize().width)/ 2,(d.height- frame.getSize().height)/ 2);
frame.setVisible(true);
}
// Declare dataMember
//********************
boolean isLeapYear,isEverPressBtn=false;
int thisYear,EnterYear,EnterMonth;
//***********************************************************************************
//Methods
//***********************************************************************************
//-----计算该年天数---------------
public int checkYear(int Year){
if(Year%4==0&&Year%100!=0){
thisYear= 366;
}
if(Year%100==0&&Year%400==0){
thisYear= 366;
}
else if(Year%4!=0){
thisYear=365;
}
return thisYear;
}
//--------------------------------
//------查看是否闰年----------------
public boolean checkLeapYear(int Year){
if(Year%4==0&&Year%100!=0){
isLeapYear=true;
}
if(Year%400==0)
isLeapYear=true;
else if(Year%4!=0){
isLeapYear=false;
}
return isLeapYear;
}
//---------------------------------
//--------计算当月天数---------------
//要输入年份的原因是要判断二月29天还是28天
public int checkMonth(int Month,int Year){
int Dates=0;
if(Month<0||Month>12){
System.out.println("Month Error");
}
if(Month==1||Month==3||Month==5||
Month==7||Month==8||Month==10||
Month==12){
Dates=31;
}
if(Month==2&&this.checkLeapYear(Year)){
Dates=29;
}
if(Month==2&&!this.checkLeapYear(Year)){
Dates=28;
}
if(Month==4||Month==6||Month==9||Month==11){
Dates=30;
}
return Dates;
}
//------------------------------------
//-----用递归法计算目标年到已知年的总天数---
public int counterYearDates(int EnterYear){
int sum1=0;
if(EnterYear==2001){//2001年为已知年
sum1=0;//递归从此跳出
}
if(EnterYear>2001){
sum1+=this.checkYear(EnterYear-1)
+this.counterYearDates(EnterYear-1);
}
//当目标年大于2001年,则从目标年-1往前累加
//到2001年为止
if(EnterYear<2001){
sum1+=this.checkYear(EnterYear)
+this.counterYearDates(EnterYear+1);
}
//当目标年小于2001年,则从目标年往后累加
//到2001年为止
return sum1;
}
//-----计算目标年从一月到目标月的总天数------------------------
//要输入年份的原因是要判断二月29天还是28天
public int counterMonthDates(int EnterMonth,int EnterYear){
int sum2=0;
if(EnterMonth==1){
sum2=0;
}
if(EnterMonth>1&&EnterMonth<=12){
sum2+=this.checkMonth(EnterMonth-1,EnterYear)
+this.counterMonthDates(EnterMonth-1,EnterYear);
}
else if(EnterMonth<0){
System.out.print("Month Error");
}
return sum2;
}
//------------------------------------------------
//-------------用数组存目标月日期-----------------------------
public int[] Array(int AllDates,int EnterMonth){
int n=AllDates%7;
int a=1;
int[] DayInTable=new int[38];
if(n<0)//Keep the n bigger than 0
n=7+n+1;//Line 207 haven´t add 1,so here add
if(n!=0)
for(int i=n;i<this.checkMonth(EnterMonth,EnterYear)+n;i++){
DayInTable[i]=a;
a++;
}
else
for(int i=7;i<this.checkMonth(EnterMonth,EnterYear)+7;i++){
//若n为0,则说明目标月一号为星期日
DayInTable[i]=a;
a++;
}
return DayInTable;
}
//----------------------------------------------------------
//-----------打印输出-------------------------------
public void printTable(int[]DayInTable){
System.out.println("Curren Date is: Year"
+EnterYear+" Month"+EnterMonth);
System.out.print("Mon Tue Wed Thur Fri Sat Sun");
System.out.println();
for(int i=1;i<=37;i++){
if(DayInTable[i]==0)
System.out.print("");
if(i%7==0&&DayInTable[i]!=0){//防止在最后i=35时输出0
System.out.print(DayInTable[i]+"");
System.out.println();
}
else if(DayInTable[i]>9)
System.out.print(DayInTable[i]+"");
else if(DayInTable[i]!=0)//防止在最后i<9时输出0
System.out.print(DayInTable[i]+"");
if(i==37)
System.out.println();
}
}
//-----------------------------------------------------
//---------------按钮触发事件---------------------
void jButton1_actionPerformed(ActionEvent e){
/*
***********refresh Datas******************
if(isEverPressBtn){
Dates=0;AllDates=0;sum1=0;sum2=0;thisYear=0;
/*如果这几个变量在方法里声明,则不用刷新,请看CalendarV2*/
//}
/******Left All Datas go back to 0****/
int AllDates=0;
String a,b;
a=jTextField1.getText();
b=jTextField2.getText();
EnterYear=Integer.parseInt(a);
EnterMonth=Integer.parseInt(b);
if(EnterYear>=2001){
AllDates=this.counterYearDates(EnterYear)
+this.counterMonthDates(EnterMonth,EnterYear)+1;
}
else if(EnterYear>0){
AllDates=-this.counterYearDates(EnterYear)
+this.counterMonthDates(EnterMonth,EnterYear);
}
else
System.out.print("Year Error");
printTable(Array(AllDates,EnterMonth));
isEverPressBtn=true;
}
JButton jButton2= new JButton();
void jButton2_actionPerformed(ActionEvent e){
System.exit(1);
}
//--------------------------------------------------------
//***********************************************************************************
//Methods
//***********************************************************************************
}
class CalendarV2_jButton1_actionAdapter implements java.awt.event.ActionListener{
CalendarV2 adaptee;
CalendarV2_jButton1_actionAdapter(CalendarV2 adaptee){
this.adaptee= adaptee;
}
public void actionPerformed(ActionEvent e){
adaptee.jButton1_actionPerformed(e);
}
}
class CalendarV2_jButton2_actionAdapter implements java.awt.event.ActionListener{
CalendarV2 adaptee;
CalendarV2_jButton2_actionAdapter(CalendarV2 adaptee){
this.adaptee= adaptee;
}
public void actionPerformed(ActionEvent e){
adaptee.jButton2_actionPerformed(e);
}
}
急求旅游网日历插件Calendar.js使用
以下都是从你给的参考的网站剥离出
<div class="bchome-456d-f758-821c-8758 calendar">
<div class="bchome-f758-821c-8758-1750 outer clearfix" id="calendarcontainer">//日历控件容器
</div>
</div>
涉及到的js文件:
1.Calendar.js地址:http://bj.tourex.net.cn/js/Calendar.js
2.jquery.js(这个要打开看看,里面的内容并不是jQuery)地址:http://bj.tourex.net.cn/sys/js/jquery.js
3.jquery.validate.check.js地址:http://bj.tourex.net.cn/sys/js/jquery.validate.check.js
4.line.js(日历月显示调用函数就在这个里面)地址:http://bj.tourex.net.cn/js/line.js
5.myfocus-2.0.4.min.js地址:http://bj.tourex.net.cn/js/plugin/myfocus-2.0.4.min.js
核心的调用代码如下(该函数可能还需要和另外的js配合使用。):
CreateCalendar(c, y, m, a, b,d, f,fu)
参数说明: c:容器,
y:年,
m:月,
a:出发时间XML,
b:参团人群,
d:是否天天发团,
f:是否显示双日历,
fu:回调
使用例子:
1. CalendarPage('calendarcontainer',2014,4);//显示4、5月份日历
2.CalendarPage('calendarcontainer',2014,2);//显示2、3月份日历
function CreateCalendar(c, y, m, a, b,d, f,fu){//c:容器,y:年,m:月,a:出发时间XML,b:参团人群,d:是否天天发团,f:是否显示双日历,fu:回调 LC[c]= [c, y, m, a, b, d,f, fu]; var today= new Date(Date.parse(webconfig('date').replace(/-/g,'/'))); today= new Date(today.getFullYear(),today.getMonth(),today.getDate()); if(y== 0|| m== 0){ y= today.getFullYear(); m= today.getMonth()+ 1;};var dmin=Date.parse(a.first().attr('d').replace(/-/g,'/')),dmax=Date.parse(a.last().attr('d').replace(/-/g,'/')); var i1= 0, i2= 0, i3= 0, d1= new Date(dmin), d2; today= today.DateToParse(); if(Date.parse(d1.getFullYear()+'/'+(d1.getMonth()+ 1)+'/1')> Date.parse(new Date(y,m-1,1))){ y= d1.getFullYear(); m= d1.getMonth()+ 1;}$('#'+ c).html('');//农历//var ca=new Calendar();tmp='';for(var i=0;i<=f;i++){d1=new Date(y,m-1+i);y=d1.getFullYear();m=d1.getMonth()+ 1;tmp+='<table cellpadding="0">';tmp+='<tr class="bchome-821c-8758-1750-78f4 month"><th colspan="7"><div class="bchome-8758-1750-78f4-4766 clearfix"><div class="bchome-1750-78f4-4766-852f prevMonth">';if(i==0){i1=Date.parse(y+'/'+ m+'/1');d1= new Date(dmin);if(Date.parse(d1.getFullYear()+'/'+(d1.getMonth()+ 1)+'/1')<i1){d1= new Date(y,m-2-f,1);tmp+='<a class="bchome-78f4-4766-852f-9077 prev" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="javascript:;" onclick="CalendarPage(\''+ c+'\','+ d1.getFullYear()+','+(d1.getMonth()+ 1)+');" title="上个月"></a>';}else{tmp+='<a class="bchome-4766-852f-9077-3628 prev0" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="javascript:;" title="上个月"></a>';}}tmp+='</div>';tmp+='<div class="bchome-852f-9077-3628-0bec dates"><em>'+ y+'</em>年<em>'+ m+'</em>月</div>';tmp+='<div class="bchome-9077-3628-0bec-159e nextMonth">';if(i==f){i1=Date.parse(y+'/'+ m+'/1');d1= new Date(dmax);i2=Date.parse(d1.getFullYear()+'/'+(d1.getMonth()+ 1)+'/1');if(i2>i1){d1= new Date(y,Date.parse(new Date(y,m+1,1))>i2?m-f:m,1);tmp+='<a class="bchome-3628-0bec-159e-f255 next" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="javascript:;" onclick="CalendarPage(\''+ c+'\','+ d1.getFullYear()+','+(d1.getMonth()+ 1)+');" title="下个月"></a>';}else{tmp+='<a class="bchome-0bec-159e-f255-1270 next0" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" href="javascript:;" title="下个月"></a>';}}tmp+='</div></div></th></tr>';tmp+='<tr class="bchome-159e-f255-1270-d42c week">';tmp+='<th class="bchome-f255-1270-d42c-83fb weekEnd">星期日</th>';tmp+='<th>星期一</th>';tmp+='<th>星期二</th>';tmp+='<th>星期三</th>';tmp+='<th>星期四</th>';tmp+='<th>星期五</th>';tmp+='<th class="bchome-0266-5882-456d-f758 weekEnd">星期六</th>';tmp+='</tr>';var maxdays=(new Date(Date.parse(new Date(y,m,1))- 86400000)).getDate();//当前月的天数d1= new Date(y,m-1);//要显示的日期i1= d1.getDay();//这个月的第一天是星期几for(var j= 1; j<= 6; j++){tmp+='<tr>';for(var k= 1; k<= 7; k++){i2=(j- 1)* 7+ k- i1;if(i2< 1|| i2> maxdays){tmp+='<td></td>';} else{i3= Date.parse(new Date(y,m-1,i2));d1=new Date(i3);//农历(ll的值为农历)/*var ll=ca.getlf(d1);if(ll==''){ll=ca.getsf(d1);if(ll==''){ll=ca.getst(d1);if(ll=='')ll=ca.getls(d1)[3];}}*/tmp+='<td'if(today== i3){tmp+=' class="bchome-5882-456d-f758-821c cur"'};if(i3< dmin|| i3> dmax){tmp+='><p><em>'+ i2+'</em></td>';} else{tmp+=' week="'+(k- 1)+'" id="'+ y+'-'+ m+'-'+ i2+'"><p><em>'+ i2+'</em></p></td>';}}}tmp+='</tr>';}tmp+='</table>';}$('#'+ c).append(tmp); var obj,crowdid=0;for(var i in currentLP.crowd){if(crowdid==0)crowdid=currentLP.crowd[i].id;}a.each(function(){obj=$('#'+$(this).attr('d'));var j={d:$(this).attr('d'),n:$(this).attr('n'),c:[]},k=0;$(this).children('c').each(function(i){if(crowdid==$(this).attr('i'))k=i;j.c.push({i:$(this).attr('i'),n:$(this).attr('n'),p:$(this).attr('p')});});obj.data('i',j).attr('v',1).append('<p><em class="bchome-456d-f758-821c-8758 money">'+(j.c[k].p==-1?'电询':'¥'+j.c[k].p)+'</em></p><p>余位'+(j.n==-1||j.n>9?'><em class="bchome-f758-821c-8758-1750 money">9</em>':'<em class="bchome-821c-8758-1750-78f4 money">'+j.n+'</em>')+'</p>');}); if($.isFunction(fu)){$('#'+ c+' td[v]').click(function(){ fu(this);}).hover( function(){$(this).addClass("hover");}, function(){$(this).removeClass("hover");});}}
calendar.js和急求旅游网日历插件Calendar.js使用的问题分享结束啦,以上的文章解决了您的问题吗?欢迎您下次再来哦!