`

jQuery google日历练习-20130821

 
阅读更多
一、效果及功能说明

模仿google日历自己来完成一个日历的所有效果

二、我的想法

通过jquery来直接写入页面表格不需要在body里面写用循环直接在循环出来

现在已经循环出来24个小时和所有内容表格

但是内容表格还无法全部的分清楚,原本是上下两个不同的时间点但是现在会上半部分的全部显示完以后下半部分才显示出来

还有的就是浮动框还没做出来,和点击的事件获得每个半小时的时间和日期,还有上面的具体时间还没做


因为有问题所有昨天好好的查了jquery的创建方法在上网一般有三个方法只有前面一个方法有用后再来早上的时候总算才在jquery官方网站上面找到一个可以创建方法的例子解决了循环重复定义的问题 但是在这里还是有循环的表格可以出现但是时间还拿不到

<今天的想法>今天好好的重新的看了官方的google日历里面看到不是全部都是用jquery写的大部分都是js这个让有了很大的启发还有在以前我总是想着日期的问题是从当天开始循环的但是在认真的研究以后发现其实不是的 google日历是以一周为一个时间单位周一到周七的星期是不会变的只有天数和月份在一直改变着这个给了我很大的启发天数应该从周期着手这样就避免了日期每天都会更新的问题


三、效果图




四、代码

<!DOCTYPE html>

<head>
<meta charset="UTF-8">
<style type="text/css">
* { 
	margin:0;
	padding:0px;
} 

body{
	font-family:Microsoft YaHei;
}

.ensemble{
	float:left;
	margin-top: 100px;
	margin-left: 100px;
}

.table-left{
	float:left;
	width:146px;
}

.table-left table tr th{
	float:left;
	width:140px;
	height:40px;
	border:1px solid #C4E1FF;
	overflow:hidden;
	padding-top: 10px;
	font-weight:normal;
}

.table-right{
	float:left;
	margin-left: -5px;
}

.top{
	float:left;
	margin-top: 0px;
	width:140px;
	height:26px;
	border:1px solid #C4E1FF;
	border-bottom: 1px dashed #C4E1FF;
}

.below{
	float:left;
	margin-top: -2px;
	width:140px;
	height:25px;
	border-left: 1px solid #C4E1FF;
	border-right: 1px solid #C4E1FF;
	border-bottom:1px solid #C4E1FF;
}

.input-field{
	position:relative;
	top: 0px;
	left: 0px;
	width:400px;
	height:150px;
	border:1px solid #C4E1FF;
	display:none;
}

.input-one{
	float:right;
	width:200px;
	height:20px;
	margin-top: 70px;
	margin-right: 100px;
}

.input-two{
	float:left;
	margin-top: 120px;
	margin-left: 10px;
}

</style>
<script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function()
{
	//这是在写标题的年月日
	var time = new Date();
	var year = time.getFullYear();
	var moon = time.getMonth() + 1;
	var sky = time.getDate() - 2;
	var addsky = time.getDate() + 7 - 2;
	$("#title").append(year + '年');
	$("#title").append(moon + '月');
	$("#title").append(sky + '日');
	$("#title").append('-' + addsky + '日');
	
	//定义按钮按下后让浮层隐藏起来和通过jquery来取得表格的id
	$("#input-two").click(function()
	{
		//$("#0tr"+hour+"td"+i).html() == $("#input-one").val();
		$("#0tr"+hour+"td"+i).append($("#input-one").val());
		//alert($("#input-one").val());
		$("#input-field").css("display","none");
	});
	
	//定义表单的任意表格让浮层出现
	$("#table-right td").click(function()
	{
		$("#input-field").css("display","block");
		//$(this).css("background-color","#000000");
		//alert(11);
	});
});
function titles(titleNum)
{
	//这里是通过js来循环24小时的表格
	var titleText = new Array("上午12点","上午1点","上午2点","上午3点","上午4点","上午5点","上午6点","上午7点","上午8点","上午9点","上午10点","上午11点","下午12点","下午1点","下午2点","下午3点","下午4点","下午5点","下午6点","下午7点","下午8点","下午9点","下午10点","下午11点");
	document.write('<th>'+titleText[titleNum]+'</th>');
}
function toptable(hour)
{
	//是循环上放的带虚线的表格 并且给与ID
	for(i=1; i<8; i++)
	{
		document.write('<td id="0tr'+hour+'td'+i+'" class="top"></td>');
	}
}
function belowtable(hour)
{
	//是循环下面不带虚线的表格 并且给与ID
	for(i=1; i<8; i++)
	{
		document.write('<td id="1tr'+hour+'td'+i+'" class="below" ></td>');
	}
} 
</script>
</head>

<body>
<div class="ensemble">
	<div id="title" class="title">
	
	</div>
	<div id="input-field" class="input-field">
		<input id="input-two" class="input-two" type="button" value="创建任务"/>
		<input id="input-one" class="input-one" type="text" />
	</div>
	<div class="overall-table">
		<div class="table-left">
			<table cellspacing="0">
			<script language="javascript" type="text/javascript">
				for (j=0;j<24;j++)
				{
					document.write("<tr>");
					titles(j);
					document.write("</tr>");
				}
			</script>
			</table>
		</div>
		<div id="table-right" class="table-right">
			<table cellspacing="0">
			<script language="javascript" type="text/javascript">
			for (z=0;z<24;z++)
			{
				document.write("<tr>");
				toptable(z);
				document.write("</tr><tr>");
				belowtable(z);
				document.write("</tr>");
			}
			</script>
			</table>
		</div>
	</div>
</div>
</body>
</html>

  • 大小: 74.8 KB
分享到:
评论
2 楼 xjwolaile 2013-08-22  
我是有复制,我是把前面的想法复制下来了,但是后面有我当前的想法,我把前面的想法复制下来是用来做对比的,当我有的一个觉得比以前更适合的想法的时候我就会把以前的想法给删掉,但后重新记入下自己的新想法,我以后会在我当前的想法前面加上<今天的想法>来区别以前和现在的想法的区别
1 楼 萧远山 2013-08-22  
你每天的想法都一样?复制过来糊弄人是吧

相关推荐

    jquery-3.7.0.min.js(jQuery下载)

    jquery-3.7.0.min.js(jQuery下载)jquery-3.7.0.min.js(jQuery下载)jquery-3.7.0.min.js(jQuery下载)jquery-3.7.0.min.js(jQuery下载)jquery-3.7.0.min.js(jQuery下载)jquery-3.7.0.min.js(jQuery下载)...

    jquery.datepicker-zh-CN.js

    jquery datepicker 的中文包 调用方法 &lt;script src="./public/js/jquery-ui-1.10.3.min.js"&gt; &lt;script src="./public/js/jquery.datepicker-zh-CN.js"&gt;&lt;/script&gt; &lt;link href="./public/css/jqueryui/jquery-ui-...

    jquery-uijquery-ui-1.7.3.custom.zip

    jquery-uijquery-uijquery-uijquery-uijquery-uijquery-uijquery-uijquery-uijquery-uijquery-uijquery-uijquery-uijquery-uijquery-uijquery-uijquery-ui

    jquery-ui-1.8.16

    jquery-ui-1.8.16jquery-ui-1.8.16jquery-ui-1.8.16jquery-ui-1.8.16jquery-ui-1.8.16jquery-ui-1.8.16jquery-ui-1.8.16jquery-ui-1.8.16jquery-ui-1.8.16jquery-ui-1.8.16jquery-ui-1.8.16jquery-ui-1.8.16jquery-...

    插件jquery-ui-timepicker-addon.js

    jquery插件jquery-ui-timepicker-addon.j

    【jquery插件】jquery.maskedinput-1.2.2.js

    【jquery插件】jquery.maskedinput-1.2.2.js

    Jquery智能提示 jquery&vsdoc1.4.0-2.1.0

    Jquery智能提示完整全部版本 jquery&vsdoc1.4.0-2.1.0 jquery-1.4.2.min.js jquery-1.4.3-vsdoc.js jquery-1.4.3.min.js jquery-1.4.4-vsdoc.js jquery-1.4.4.min.js jquery-1.4.min.js jquery-1.5-vsdoc.js...

    jquery插件jquery-ui-1.8.2.custom.min.js

    《jQuery UI与jQuery插件深度解析——以jquery-ui-1.8.2.custom.min.js为例》 在Web开发领域,jQuery库以其简洁易用的API和强大的功能深受开发者喜爱。而jQuery UI作为jQuery的一个扩展,提供了丰富的用户界面组件...

    jquery日历插件e-calendar升级版

    《jQuery日历插件e-calendar升级版详解与应用》 在Web开发中,日历插件是常见的交互元素,用于展示时间相关的数据和事件。本文将深入探讨jQuery日历插件e-calendar的升级版,该插件以其易用性和丰富的功能,为...

    jQuery-Timepicker-Addon-master(jquery 日历时间)

    《jQuery-Timepicker-Addon:构建高效日历时间选择器》 在Web开发中,用户界面的易用性和交互性是至关重要的。jQuery-Timepicker-Addon是jQuery库的一个扩展,为网页提供了一种优雅的方式来处理日期和时间的选择。...

    jQuery动画特效---精通JavaScript+jQuery

    第0课 - 内容概述 - [精通JavaScript+jQuery] 第1课 - JavaScript背景知识-[精通JavaScript+jQuery] 第2课 - JavaScript基础 - [精通JavaScript+jQuery] 第3课 - CSS基础 - [精通JavaScript+jQuery] 第4课 - CSS...

    jQuery摄像头插件jquery-webcam-plugin

    **jQuery摄像头插件jquery-webcam-plugin** 在网页开发中,集成摄像头功能可以帮助用户实时捕捉图像,广泛应用于在线证件照上传、视频聊天、虚拟试衣间等场景。`jQuery webcam plugin`是一个优秀的JavaScript库,它...

    Calendar-price-jquery日历价格插件

    《jQuery日历价格插件——实现高效前端交互与动态数据展示》 在现代网页开发中,用户界面的交互性与视觉吸引力是提升用户体验的关键因素之一。"Calendar-price-jquery"是一款基于jQuery的实用插件,它专为网页设计...

    jquery-migrate-1.2.1.js文件

    **jQuery Migrate插件详解** `jquery-migrate-1.2.1.js` 文件是jQuery的一个辅助工具,它主要用于帮助开发者解决在升级到较新版本的jQuery时可能遇到的向后兼容性问题。这个插件的主要目的是为了警告开发者那些在新...

    google 社区 jquery-ui-themes-1.8.12.zip

    《jQuery UI Themes 1.8.12:Google 社区资源详解》 在Web开发领域,jQuery UI是一个广泛使用的JavaScript库,它扩展了基础的jQuery功能,提供了丰富的用户界面组件,如日期选择器、对话框、拖放操作等。jQuery UI...

    Jquery 实现日历(calendar)功能

    对于日历(Calendar)功能的实现,jQuery 提供了一个强大的工具集,帮助开发者快速创建交互式、功能丰富的日历组件。本篇文章将深入探讨如何使用 jQuery 实现日历功能,以及相关的知识点。 首先,我们需要理解日历...

    jquery精简版jquery-small.js

    jquery 精简版 jquery 精简版 jquery 精简版jquery 精简版 jquery 精简版 jquery 精简版 jquery 精简版

    jQuery插件---mcdropdow.(仿下拉框多层次)

    jQuery插件---mcdropdow.(仿下拉框多层次)jQuery插件---mcdropdow.(仿下拉框多层次)jQuery插件---mcdropdow.(仿下拉框多层次)jQuery插件---mcdropdow.(仿下拉框多层次)jQuery插件---mcdropdow.(仿下拉框多层次)

    jQuery打印插件----jQuery.print.js

    jQuery打印插件----jQuery.print.js实现网页的打印功能,亲测有效

    jquery智能提示jquery-1.6.1-vsdoc.js

    jquery智能提示jquery-1.6.1-vsdoc.js

Global site tag (gtag.js) - Google Analytics