PHP+AJAX创建的动态网页在线日历

所属分类: PHP源码-PHP笔记    2024-01-22 06:01:37

PHP+AJAX创建的动态网页在线日历 ie兼容6

PHP+AJAX创建的动态网页在线日历(共4个文件)

    • calendar-ajax.php
    • index.php
    • jquery-1.11.2.min.js
    • style.css
    • loading.gif
    • class.calendar.php

使用方法

currentYear = date ( "Y", time () );
		$this->currentMonth = date ( "m", time () );
		
		if (! empty ( $_POST ['year'] )) {
			$this->currentYear = $_POST ['year'];
		}
		if (! empty ( $_POST ['month'] )) {
			$this->currentMonth = $_POST ['month'];
		}
		$this->currentMonthStart = $this->currentYear . '-' . $this->currentMonth . '-01';
		$this->currentMonthDaysLength = date ( 't', strtotime ( $this->currentMonthStart ) );
	}
	
	function getCalendarHTML() {
		$calendarHTML = '
'; $calendarHTML .= '
' . $this->getCalendarNavigation() . '
'; $calendarHTML .= '
    ' . $this->getWeekDayName () . '
'; $calendarHTML .= '
    ' . $this->getWeekDays () . '
'; $calendarHTML .= '
'; return $calendarHTML; } function getCalendarNavigation() { $prevMonthYear = date ( 'm,Y', strtotime ( $this->currentMonthStart. ' -1 Month' ) ); $prevMonthYearArray = explode(",",$prevMonthYear); $nextMonthYear = date ( 'm,Y', strtotime ( $this->currentMonthStart . ' +1 Month' ) ); $nextMonthYearArray = explode(",",$nextMonthYear); $navigationHTML = ' '; $navigationHTML .= '' . date ( 'M', strtotime ( $this->currentMonthStart ) ) . ''; $navigationHTML .= ''. date ( 'Y', strtotime ( $this->currentMonthStart ) ) . ''; $navigationHTML .= ' '; return $navigationHTML; } function getWeekDayName() { $WeekDayName= ''; foreach ( $this->weekDayName as $dayname ) { $WeekDayName.= '
  • ' . $dayname . '
  • '; } return $WeekDayName; } function getWeekDays() { $weekLength = $this->getWeekLengthByMonth (); $firstDayOfTheWeek = date ( 'N', strtotime ( $this->currentMonthStart ) ); $weekDays = ""; for($i = 0; $i < $weekLength; $i ++) { for($j = 1; $j <= 7; $j ++) { $cellIndex = $i * 7 + $j; $cellValue = null; if ($cellIndex == $firstDayOfTheWeek) { $this->currentDay = 1; } if (! empty ( $this->currentDay ) && $this->currentDay <= $this->currentMonthDaysLength) { $cellValue = $this->currentDay; $this->currentDay ++; } $weekDays .= '
  • ' . $cellValue . '
  • '; } } return $weekDays; } function getWeekLengthByMonth() { $weekLength = intval ( $this->currentMonthDaysLength / 7 ); if($this->currentMonthDaysLength % 7 > 0) { $weekLength++; } $monthStartDay= date ( 'N', strtotime ( $this->currentMonthStart) ); $monthEndingDay= date ( 'N', strtotime ( $this->currentYear . '-' . $this->currentMonth . '-' . $this->currentMonthDaysLength) ); if ($monthEndingDay < $monthStartDay) { $weekLength++; } return $weekLength; } } ?>

    站长提示:
    1. 苦力吧素材官方QQ群:950875342
    2. 平台上所有素材资源,需注册登录会员方能正常下载。
    3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励2K币
    4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
    5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
    相关资源 / PHP笔记

    基于Dropzone创建的带进度条上传文件插件

    一款将php文件上传到服务器指定目录示例,通过Dropzone使用进度条进行文件上传编码,实现在线预览、上传状态显示及文件重命名。
      PHP笔记
     3309  0

    PHP在线贴纸便签记事本网站源码

    一款简易的在线记事本系统源码,核心功能:贴纸列表、查看内容、编辑内容、删除内容。
      PHP笔记
     2279  0

    PHP简单的图片在线管理系统网站源码

    一款响应式图片管理系统,主要的核心功能:图片上传、图片展示、列表分页等,此源码无后台系统。
      PHP笔记
     8184  0

    PHP上传图片文件到服务器和MYSQL数据库实现源码

    一款基于php+mysql上传图片并输出展示的源代码,核心功能:选择本地图片上传保存到服务器指定文件夹,同时把图片路径和图片名称保存到数据表,此源码无后台管理系统。
      PHP笔记
     6210  0

    评论数(0) 回复有机会获得K币 用户协议

    ^_^ 还没有人评论,快来抢个沙发!
    😀
    • 😀
    • 😊
    • 😂
    • 😍
    • 😑
    • 😷
    • 😵
    • 😛
    • 😣
    • 😱
    • 😋
    • 😎
    • 😵
    • 😕
    • 😶
    • 😚
    • 😜
    • 😭
    发表评论