<!--
var date=new Date()
var year=date.getYear()
var month=date.getMonth()
month=month+1
var day=date.getDate()
var weekday=new Array(7)
weekday[0]="星期日"
weekday[1]="星期一"
weekday[2]="星期二"
weekday[3]="星期三"
weekday[4]="星期四"
weekday[5]="星期五"
weekday[6]="星期六"
document.write("当前日期为:"+year+"年"+month+"月"+day+"日"+ weekday[date.getDay()]+"第13周")
//-->
</script>
日期插件的包为: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:完整页面代码
<?phpdate_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>