㈠ php怎样添加JS日历控件
日期插件的包为:mydate.js。
1:首先将日期插件的包引入到页面中
<scriptlanguage="JavaScript"src="../Inc/Js/mydate.js"></script>
2:设置鼠标点击事件,当鼠标点击获得焦点的时候,触发事件,调用方法
<inputtype="text"name="starttime"onfocus="MyCalendar.SetDate(this)"value="<?phpecho$rq;?>">
<inputtype="text"name="endtime"onfocus="MyCalendar.SetDate(this)"value="<?phpecho$rq;?>">
3:完整页面代码
<?php
date_default_timezone_set("PRC");
$nowtime=time();
$rq=date("Y-m-d",$nowtime);
?>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>
<metaname="generator"content="FFKJ.Net"/>
<linkrev="MADE"href="mailto:[email protected]">
<title>在线--后台</title>
<linkrel="stylesheet"type="text/css"href="../Skins/Admin_Style.Css"/>
<scriptlanguage="JavaScript"src="../Inc/Js/mydate.js"></script>
</head>
<body>
开始时间:<inputtype="text"name="starttime"onfocus="MyCalendar.SetDate(this)"value="<?phpecho$rq;?>">
结束时间:<inputtype="text"name="endtime"onfocus="MyCalendar.SetDate(this)"value="<?phpecho$rq;?>">
</body>
</html>
㈡ php日历插件的制作方法,求思路
<?phpheader("content-type:text/html;charset=utf-8");?>
<?php?>
<tableclass="tabletable-stripedtable-hover">
<?php
//注:32位机器或者32位PHP版本可能只能计算到2038年之前的月份
//若没有GET方法传入参数,则使用服务器本地当前日期;否则使用传入的参数,方便跳转月份
$year=date("Y");
$month=date("n");
$alert="<divclass='alertalert-warning'>输入的日期格式有误!</div>";
$alertYear="<divclass='alertalert-warning'>无法计算1901年以前的日历!</div>";
if($_REQUEST){
$year=$_REQUEST["year"];
$month=$_REQUEST["month"];
}
if(!in_array($month,array("1","2","3","4","5","6","7","8","9","10","11","12"))){echo$alert;exit;}
if($year<1901){echo$alertYear;exit;}
?>
<caption><h4><?phpecho$year;?> 年 <?phpecho$month;?> 月</h4></caption>
<?php
//计算当前日期,当月天数,获得星期数据,将默认星期天数字0改为7,方便处理循环
$today=date("j");
$days=date("t",strtotime("$year-$month-01"));
$week=date("w",strtotime("$year-$month-01"));
if($week==0){$week=7;}
?>
<tr>
<th>一</th>
<th>二</th>
<th>三</th>
<th>四</th>
<th>五</th>
<th>六</th>
<th>日</th>
</tr>
<tr>
<?php
//插入空白无日期区域,循环次数为当前月第一天的星期数-1
for($space=1;$space<$week;$space++){
echo"<td>-</td>";
}
//循环插入数据,当到达周日时换行输出;标记当前日期为红色
for($day=1;$day<=$days;$day++){
if(($day+$week-1)%7===0){
if($day==$today&&$year==date("Y")&&$month==date("n")){
echo"<tdstyle='background-color:pink;'>$day</td>";
echo"</tr>";
echo"<tr>";
}
echo"<td>$day</td>";
echo"</tr>";
echo"<tr>";
}else{
if($day==$today&&$year==date("Y")&&$month==date("n")){
echo"<tdstyle='background-color:pink;'>$day</td>";
}else{
echo"<td>$day</td>";
}
}
}
//尾部补足
$spacing=36-$days-$week<0?43-$days-$week:36-$days-$week;
for($footer=1;$footer<=$spacing;$footer++){
echo"<td>-</td>";
}
?>
</tr>
</table>
我以前写的,你随意看看~~
㈢ 如何写日历空间。直接在页面上显示。(php)
去jqueryui.com官网,下载日历控件,上面有很详细的使用说明
$("#id").datepicker();绑定id就可以了,还可以设置参数
㈣ PHP 日历插件怎么让默认显示的时间不是今天,而是自定义或者数据库读取出来的时间
建议你存的时候存用time()函数的到的秒,数据表字段类型弄成int(10)就可以,输出的时候可以直接用date('Y-m-d',db['time'])格式化输出了!
㈤ 高分求个PHP日历挂件
My97DatePicker
很好用的一个日历控件,常用的几个浏览器都能够兼容。你可下载试试看。
㈥ 怎样在网页中插入日历控件
日期插件的包为:mydate.js。
1:首先将日期插件的包引入到页面中
<scriptlanguage="JavaScript"src="../Inc/Js/mydate.js"></script>
2:设置鼠标点击事件,当鼠标点击获得焦点的时候,触发事件,调用方法
<inputtype="text"name="starttime"onfocus="MyCalendar.SetDate(this)"value="<?phpecho$rq;?>">
<inputtype="text"name="endtime"onfocus="MyCalendar.SetDate(this)"value="<?phpecho$rq;?>">
3:完整页面代码
<?php
date_default_timezone_set("PRC");
$nowtime=time();
$rq=date("Y-m-d",$nowtime);
?>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>
<metaname="generator"content="FFKJ.Net"/>
<linkrev="MADE"href="mailto:[email protected]">
<title>在线--后台</title>
<linkrel="stylesheet"type="text/css"href="../Skins/Admin_Style.Css"/>
<scriptlanguage="JavaScript"src="../Inc/Js/mydate.js"></script>
</head>
<body>
开始时间:<inputtype="text"name="starttime"onfocus="MyCalendar.SetDate(this)"value="<?phpecho$rq;?>">
结束时间:<inputtype="text"name="endtime"onfocus="MyCalendar.SetDate(this)"value="<?phpecho$rq;?>">
</body>
</html>
4:页面效果:
㈦ php如何给input加上日历的功能
用My97日期控件吧
http://www.my97.net/dp/demo/index.htm
里面例子很多,超级好用,什么情况都有,收藏起来吧。
如果你要用jquery 比较漂亮的UI的
http://www.oschina.net/project/tag/278/jquery-calendar
这里要什么有什么
㈧ php如何 获取 my97datepicker日历控件提交的值!
表单提交的话。
若是get请求,$_GET['startDate'], post请求则是$_POST['startDate']
㈨ HTML5+PHP要怎么制作日历
JS有个dataPicker控件,如果是自己来做需要写循环判断算法