您的位置:

淘宝网日历控件js代码,web日历控件

本文目录一览:

点在图片上 显示日历框 可以选择日历上的日期 来查询对应时间数据库的信息 这个JSP代码怎么写

%@ page contentType="text/html; charset=gb2312" %

%@ page language="java" import="java.util.*" %

%

response.setHeader("Cache-Control", "no-store");

response.setHeader("Pragma", "no-cache");

response.setDateHeader("Expires", 0);

%

html

head

title选择日期/title

meta http-equiv="Content-Type" content="text/html; charset=gb2312"

META name="GENERATOR" content="IBM WebSphere Studio"

style

SELECT {FONT-SIZE: 9pt; LINE-HEIGHT: 11pt}

TEXTAREA {FONT-SIZE: 9pt; LINE-HEIGHT: 11pt}

INPUT {FONT-SIZE: 9pt; LINE-HEIGHT: 11pt}

TD {FONT-SIZE: 9pt; LINE-HEIGHT: 11pt}

.p { font-size: 12px; line-height: 18px}

.pp { font-size: 14px; line-height: 18px}

.cals{font-family: "Arial"color:#000000; font-size:10pt}

/style

%@page import = "java.util.StringTokenizer"%

%

String type = request.getParameter("type");

if (type==null) type="1";

Calendar cal = Calendar.getInstance();

String cur_date = cal.get(Calendar.YEAR) + "年" + (cal.get(Calendar.MONTH)+1)

+ "月" + cal.get(Calendar.DAY_OF_MONTH)+"日";

int cur_year = cal.get(Calendar.YEAR);

int cur_month = (cal.get(Calendar.MONTH)+1);

int cur_day = cal.get(Calendar.DAY_OF_MONTH);

String cur_date_string = String.valueOf(cur_year) + "-"

+ (cur_month10?("0"+String.valueOf(cur_month)):String.valueOf(cur_month)) + "-"

+ (cur_day10?("0"+String.valueOf(cur_day)):String.valueOf(cur_day));

String parmInitDate = request.getParameter("initdate");

int parm_year=0;

int parm_month=0;

int parm_day=0;

if(parmInitDate!=null){

StringTokenizer mytoken = null;

try{

java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd");

java.util.Date date = null;

date = formatter.parse(parmInitDate);

//java.util.Calendar cal = new java.util.Calendar()

cal.setTime(date);

parm_year = cal.get(Calendar.YEAR);

parm_month = cal.get(Calendar.MONTH) + 1;

parm_day = cal.get(Calendar.DAY_OF_MONTH );

}catch(Exception e){

//out.print(e);

}

}

parm_year= parm_year==0?cur_year:parm_year;

parm_month= parm_month==0?cur_month:parm_month;

parm_day= parm_day==0?cur_day:parm_day;

%

script LANGUAGE="vbscript"

!--

dim cal(6,7)

dim sToday

dim sCurDate

dim sSeldate

dim selx,sely

sCurdate="%=cur_date_string%"

sSeldate="%=parm_year+"-"+parm_month+"-"+parm_day%"

sub getDate()

if window.event.srcElement.innerText = "" or window.event.srcElement.innerText = " " then exit sub

for i = 1 to 6

for j = 1 to 7

if cal(i,j).bgcolor="#0000ff" then

cal(i,j).bgcolor=""

cal(i,j).style.color="black"

end if

next

next

if window.event.srcElement.bgcolor"#ffff00" then

window.event.srcElement.bgcolor="blue"

window.event.srcElement.style.color="white"

end if

aa = window.year.value "-" right(window.month.value+100,2) "-" right(window.event.srcelement.innertext+100,2)

window.sel_date.innerText=aa

end sub

sub getTime()

aa=""

if window.hour.value"00" or window.minute.value"00" or window.second.value"00" then

aa=window.hour.value ":" window.minute.value ":" window.second.value

end if

if window.sel_date.innerText = "" then

window.sel_date.innerText = sCurDate

end if

window.sel_time.innerText=aa

end sub

sub ret ()

if window.sel_date.innerText "" then

window.returnValue = window.sel_date.innerText

if window.sel_time.innerText="" then

window.sel_time.innerText=window.hour.value ":" window.minute.value ":" window.second.value

end if

if window.sel_time.innerText "" then

window.returnValue = window.sel_date.innerText " " window.sel_time.innerText

end if

end if

window.event.returnValue = false

set cal(6,7) = nothing

window.close()

end sub

sub cancel ()

window.returnValue = ""

window.event.returnValue = false

set cal(6,7) = nothing

window.close()

end sub

sub draw

dim yy,mm,dd,thisday,lastmm,maxday

dim nextmm

yy = window.year.value

mm = window.month.value

dd = datepart("d",sSeldate)

thisday = dateserial (yy,mm,1)

set cal(1,1) = t10:set cal(1,2) = t11:set cal(1,3) = t12:set cal(1,4) = t13:set cal(1,5) = t14:set cal(1,6) = t15:set cal(1,7) = t16

set cal(2,1) = t20:set cal(2,2) = t21:set cal(2,3) = t22:set cal(2,4) = t23:set cal(2,5) = t24:set cal(2,6) = t25:set cal(2,7) = t26

set cal(3,1) = t30:set cal(3,2) = t31:set cal(3,3) = t32:set cal(3,4) = t33:set cal(3,5) = t34:set cal(3,6) = t35:set cal(3,7) = t36

set cal(4,1) = t40:set cal(4,2) = t41:set cal(4,3) = t42:set cal(4,4) = t43:set cal(4,5) = t44:set cal(4,6) = t45:set cal(4,7) = t46

set cal(5,1) = t50:set cal(5,2) = t51:set cal(5,3) = t52:set cal(5,4) = t53:set cal(5,5) = t54:set cal(5,6) = t55:set cal(5,7) = t56

set cal(6,1) = t60:set cal(6,2) = t61:set cal(6,3) = t62:set cal(6,4) = t63:set cal(6,5) = t64:set cal(6,6) = t65:set cal(6,7) = t66

for i = 1 to 6

for j = 1 to 7

cal(i,j).innertext = " "

cal(i,j).style.cursor = ""

cal(i,j).bgcolor=""

next

next

// cal(1,cint(datepart("w",thisday))).innertext = 1

// cal(1,cint(datepart("w",thisday))).style.cursor="hand"

//计算选择缺省日期

lastmm = datepart("m",thisday)

nextmm = lastmm + 1

if nextmm= 13 then nextmm = 1

maxday = datepart("d",dateadd("d",-1,dateserial (yy,nextmm,"1") ) )

if ddmaxday then dd = maxday

//缺省

i = 1 'the line

do until (datepart("m",thisday) - lastmm 0)

if datepart ("w",thisday) = 1 then i = i + 1

cal(i,cint(datepart("w",thisday))).innertext = datepart("d",thisday)

if thisday=date then

cal(i,cint(datepart("w",thisday))).bgcolor="#A7A4D9" 'tt1

cal(i,cint(datepart("w",thisday))).style.color="red"

else

cal(i,cint(datepart("w",thisday))).style.color="black"

end if

if(datepart("d",thisday)=dd) then

if thisdaydate then

cal(i,cint(datepart("w",thisday))).bgcolor="blue"

cal(i,cint(datepart("w",thisday))).style.color="white"

end if

dim showday

showday = datepart("yyyy",thisday) "-"

if(datepart("m",thisday)10) then

showday = showday "0"

end if

showday = showday datepart("m",thisday) "-"

if(datepart("d",thisday)10) then

showday = showday "0"

end if

showday = showday datepart("d",thisday)

window.sel_date.innerText= showday

end if

cal(i,cint(datepart("w",thisday))).style.cursor="hand"

thisday = thisday + 1

loop

for i = 1 to 6

for j = 1 to 7

cal(i,j).style.fontsize = "9pt" '" normal small-caps 8pt serif"

next

next

end sub

sub up()

for i = 1 to 6

for j = 1 to 7

if cal(i,j).bgcolor="#0000ff" then

cal(i,j).bgcolor=""

cal(i,j).style.color="black"

end if

next

next

if window.month.value = 12 then

if window.year.value 2100 then window.year.value = window.year.value + 1

window.month.value = 1

else

window.month.value = window.month.value + 1

end if

draw()

end sub

sub down ()

for i = 1 to 6

for j = 1 to 7

if cal(i,j).bgcolor="#0000ff" then

cal(i,j).bgcolor=""

cal(i,j).style.color="black"

end if

next

next

if window.month.value = 1 then

if window.year.value 1996 then window.year.value = window.year.value - 1

window.month.value = 12

else

window.month.value = window.month.value - 1

end if

draw()

end sub

--

/script

script ID="clientEventHandlersVBS" LANGUAGE="vbscript"

!--

Sub year_onchange

draw()

End Sub

Sub month_onchange

draw()

End Sub

sub init ()

aa = date()

bb = %=parm_year%

if bb = 1950 and bb = 2100 then window.year.value = bb

bb = %=parm_month%

window.month.value = bb

sToday=%=parm_day%

draw ()

end sub

--

/script

script language="javascript" for="t1" event="onkeydown"

//Esc退出

var keyDown = event.keyCode

if(keyDown==27){

window.close()

}

/script

/head

body onload="init" leftmargin="12" topmargin="7"

center

!--font class='pp'今天是%=cur_date%/fontbr --

table border="0" width="200" cellspacing="0" cellpadding="1" bgcolor="snow" id="t1" align="center"

tr

td colspan='7' nowrap

select id="year" name="year"

%for (int i=2000; i=2020; i++) {%

option value=%=i%%=i%/option

%}%

/select

select id="month" name="month"

%for (int i=1; i=12; i++) {%

option value=%=i%%=i%月/option

%}%

/select      

img src="../images/arr04.gif" id="up" language="vbscript" style='cursor:hand' onclick="down()" accesskey=1 align="absmiddle"

img src="../images/arr05.gif" id="down" language="vbscript" style='cursor:hand' onclick="up()" accesskey=2 align="absmiddle"

/td

/tr

tr

td colspan='7' height="5" /td

/tr

tr bgcolor="#7975C6"

td align='center' class="cals" height="23" align="absmiddle"日/td

td align='center' class="cals" align="absmiddle"一/td

td align='center' class="cals" align="absmiddle"二/td

td align='center' class="cals" align="absmiddle"三/td

td align='center' class="cals" align="absmiddle"四/td

td align='center' class="cals" align="absmiddle"五/td

td align='center' class="cals" align="absmiddle"六/td

/tr

%for (int i=1; i=6; i++) {%

tr bgcolor="#e6e6fa"

%for (int j=0; j=6; j++) {%

td align='center' id=t%=i%%=j% onclick="getDate()" ondblclick="ret()" class="cals"/td

%}%

/tr

%}%

%String disp=null;%

%if (type.compareTo("2")==0) {%

tr

td colspan='7' nowrap height="28" align="center" valign="bottom"

select id="hour" name="hour" onchange='getTime()'

%

for (int i=0; i=23; i++) {

disp=String.valueOf(i);

if (disp.length()==1) disp = "0"+disp;

%

option value=%=disp%%if (i==0) out.print(" selected");%%=disp%/option

%}%

/selectfont class='p'时/font

select id="minute" name="minute" onchange='getTime()'

%

for (int i=0; i=59; i++) {

disp=String.valueOf(i);

if (disp.length()==1) disp = "0"+disp;

%

option value=%=disp%%if (i==0) out.print(" selected");%%=disp%/option

%}%

/selectfont class='p'分/font

select id="second" name="second" onchange='getTime()'

%

for (int i=0; i=59; i++) {

disp=String.valueOf(i);

if (disp.length()==1) disp = "0"+disp;

%

option value=%=disp%%if (i==0) out.print(" selected");%%=disp%/option

%}%

/selectfont class='p'秒/font

/td/tr

%}%

/table

table border='0' width='180' style="display:none"

tr

td nowrap

时间:

font color='red'

span id='sel_date' name='sel_date'/span

span id='sel_time' name='sel_time'/span

/font

/td

/tr

/table

table border='0' cellspacing="0" cellpadding="0"

trtd height="4"/td/tr

trtd align="absmiddle"img src="../images/bt_sure.gif" onclick='ret()'/td/tr

/table

/center

%

String initH="00";

String initM="00";

String initS="00";

if(type.equals("2")){

if(parmInitDate==null) parmInitDate="";

parmInitDate=parmInitDate.trim();

if(parmInitDate.length()10){

initH=parmInitDate.substring(11,13);

initM=parmInitDate.substring(14,16);

initS=parmInitDate.substring(17,19);

}else{

//初始化为当前时间

java.text.SimpleDateFormat sdf=null;

String curTime="";

try{

sdf=new java.text.SimpleDateFormat("HH:mm:ss");

curTime=sdf.format(new java.util.Date());

}catch(Exception e){

curTime="00:00:00";

System.out.println("格式为日期出错");

}

initH=curTime.substring(0,2);

initM=curTime.substring(3,5);

initS=curTime.substring(6,8);

}

}

%

script language="javascript"

var itype='%=type %';

var hh='%=initH %';

var mm='%=initM %';

var ss='%=initS %';

if(itype=='2'){

//初始化数据

var objh=document.getElementById('hour');

var objm=document.getElementById('minute');

var objs=document.getElementById('second');

objh.value=hh;

objm.value=mm;

objs.value=ss;

}

/script

/body

/html

在js日历控件中如何把月和日小于10的自动在前面添加0

自定义过滤器

{{a| xxx}}

Vue.filter('xxx',function(aa){

return aa10?'0'+aa:''+aa;

})

xxx是过滤器的名字

aa 是过滤的那个数据

如果那个数据小于10,则在他前面添加一个0

比如

过滤数据是 9

过滤后变成 09

我用的是vue,逻辑就是这样

怎样在网页中插入日历控件

日期插件的包为:mydate.js。

1:首先将日期插件的包引入到页面中

script language="JavaScript" src="../Inc/Js/mydate.js"/script

2:设置鼠标点击事件,当鼠标点击获得焦点的时候,触发事件,调用方法

input type="text" name="starttime" onfocus="MyCalendar.SetDate(this)" value="?php echo $rq;?"

input type="text" name="endtime" onfocus="MyCalendar.SetDate(this)" value="?php echo $rq;?"

3:完整页面代码

?php

  date_default_timezone_set("PRC");

  $nowtime = time();

  $rq = date("Y-m-d",$nowtime);

?

html

head

meta http-equiv="Content-Type" content="text/html; charset=gb2312" /

meta name="generator" content="FFKJ.Net" /

link rev="MADE" href="mailto:FFKJ@FFKJ.Net"

title在线--后台/title

link rel="stylesheet" type="text/css" href="../Skins/Admin_Style.Css" /

script language="JavaScript" src="../Inc/Js/mydate.js"/script

/head

body

开始时间:input type="text" name="starttime" onfocus="MyCalendar.SetDate(this)" value="?php echo $rq;?"

结束时间:input type="text" name="endtime" onfocus="MyCalendar.SetDate(this)" value="?php echo $rq;?"

/body

/html

4:页面效果:

日历控件calendar.js怎么调用

以3.0为例:

项目head块中写入以下:

script language="javascript" type="text/javascript" src="~/canlendar.js"/script

调用时在所要用日期的TextBox控件加入onclick事件:onclick='popUpCalendar(this,document.form1.TextBox1,"yyyy-mm-dd")'

以上方法名popUpCalendar不同版本可能会不同,调用时看源码

淘宝网日历控件js代码,web日历控件

2022-11-23
php日历控件(PHP制作日历)

2022-11-10
php日历控件,php写日历

2022-11-30
aspnetjs日历控件(aspnet日历控件选择日期)

本文目录一览: 1、ASP.NET:将TextBox绑定日历Calendar控件,运行时,默认显示当天日期 2、asp.net关于调用calendar的问题 3、asp中怎样使用日历控件 4、求好用的

2023-12-08
php或js日历,php做日历

2022-11-22
php写控件的日历(PHP制作日历)

2022-11-12
php日历插件,php制作漂亮日历

2022-11-23
简易js网页实时时钟日历,js电子时钟代码

本文目录一览: 1、如何使用JS实现一个简易数码时钟 2、求一款js做的时间日历控件? 3、怎样在jsp页面中显示日历(高手帮下忙啦!很急) 4、用js在网页上显示当前日期和时间,并显示是星期几 5、

2023-12-08
淘宝分类js代码(淘宝搜索代码)

本文目录一览: 1、这种淘宝宝贝分类的css代码怎么做, 2、淘宝联盟搜索推广JS代码怎么放到网站上 3、在淘宝充值平台上面看他们网页原本看到这段JS代码谁可以为我解释下... 4、求助JS代码怎么转

2023-12-08
php日期控件,php显示日期

2023-01-03
js日历程序(原生js写日历)

2022-11-16
js日期控件代码文档介绍内容,jsp 日期控件

2022-11-23
淘宝登录js代码,js淘宝首页

本文目录一览: 1、在淘宝充值平台上面看他们网页原本看到这段JS代码谁可以为我解释下... 2、怎么在淘宝页面加入JS代码 3、淘宝客网站如何调用JS哦 4、js怎么实现像淘宝登陆账自动跳转到登陆前的

2023-12-08
php日历按钮(php日历和时间)

2022-11-16
Android日历控件:提高用户体验的必备组件

2023-05-14
淘宝店铺导航网站源码php版,淘宝网网站导航

2022-11-29
淘宝自动发货php源码,淘宝客源码全套

2023-01-06
js游戏控制时间代码(js游戏控制时间代码大全)

本文目录一览: 1、js时间代码 2、JS控制显示时间 3、求JS弹窗代码 可以控制弹出时间 4、关于网页调用系统时间JS代码 5、求js详细时间代码,年月日星期时分(秒),阴历日期 6、如何使用js

2023-12-08
java日历脚本,java课程设计日历记事本代码

2022-11-22
htmljs编程笔记(html代码笔记)

本文目录一览: 1、html代码和JS代码有什么区别 2、如何在html中调用js函数 3、JavaScript学习笔记之数组基本操作示例 4、HTML5初学者笔记 5、《web前端笔记7》js字符—

2023-12-08