通行证: 用户 密码 域名空间  下载中心 社区论坛 信息公告 my小屋
联系我们
设为首页
加入收藏

 

qq,asp,php,jsp,xml,sql,.net,编程 程序 网页图象 建站经验 私服
首页 | 新闻资讯 | 编程开发 | 网页设计 | 图形图象 | 网络媒体 | 网站模板 | 数 据 库 | 投稿
论坛 | 操作系统 | 系统优化 | 网络安全 | 黑客技术 | 硬件学堂 | 硬件报价 | 服 务 器 | 地图
专题 | 应用软件 | 聊天通讯 | q q 专栏 | 建站经验 | 在线工具 | 站长club | 注 册 表 | 旧版
社会 | 游戏娱乐 | 设计欣赏 | 疑难解答 | 社区论坛 | 韩国素材 | 素材图库 | 广告服务 | 服务
当前位置:首页>>网页设计>>html/css>>正文 新版上线![旧版]
注:打开慢时请稍等

html组件之:日历主页面

http://www.iyit.net  日期:2006-5-27 9:16:49  来源:转载   点击:
参加讨论】html组件之:日历主页面:

====日历主页面===

<head>
<title>calendar example</title>
<?import namespace="mycal" implementation="calendar.htc"/>
</head>

<body>
<p>click a day in the calendar to add or modify your schedule.</p>

<mycal:calendar></mycal:calendar>

</body>
</html>

===calendar htc===

<head>
<?import namespace="anyday" implementation="day.htc"/>
<?import namespace="today" implementation="today.htc"/>

<public:component tagname="calendar">
<attach event="oncontentready" onevent="fninit()"/>
</public:component>

<script language="javascript">
<!--
function fninit() {
defaults.viewlink = document;
}
// -->
</script>

<style>
td {
background-color:tan;
width:50;
height:50;
}
</style>
</head>

<body>
<script language="javascript">
<!--

// copyright 1997 -- tomer shiran

setcal();

function leapyear(year) {
if (year % 4 == 0) {// basic rule
return true; // is leap year
}
/* else */ // else not needed when statement is "return"
return false; // is not leap year
}

function getdays(month, year) {
// create array to hold number of days in each month
var ar = new array(12);
ar[0] = 31; // january
ar[1] = (leapyear(year)) ? 29 : 28; // february
ar[2] = 31; // march
ar[3] = 30; // april
ar[4] = 31; // may
ar[5] = 30; // june
ar[6] = 31; // july
ar[7] = 31; // august
ar[8] = 30; // september
ar[9] = 31; // october
ar[10] = 30; // november
ar[11] = 31; // december

// return number of days in the specified month (parameter)
return ar[month];
}

function getmonthname(month) {
// create array to hold name of each month
var ar = new array(12);
ar[0] = "january";
ar[1] = "february";
ar[2] = "march";
ar[3] = "april";
ar[4] = "may";
ar[5] = "june";
ar[6] = "july";
ar[7] = "august";
ar[8] = "september";
ar[9] = "october";
ar[10] = "november";
ar[11] = "december";

// return name of specified month (parameter)
return ar[month];
}

function setcal() {
// standard time attributes
var now = new date();
var year = now.getfullyear();
var month = now.getmonth();
var monthname = getmonthname(month);
var date = now.getdate();
now = null;

// create instance of first day of month, and extract the day on which it occurs
var firstdayinstance = new date(year, month, 1);
var firstday = firstdayinstance.getday();
firstdayinstance = null;

// number of days in current month
var days = getdays(month, year);

// call function to draw calendar
drawcal(firstday + 1, days, date, monthname, year);
}

function drawcal(firstday, lastdate, date, monthname, year) {
// constant table settings
//var headerheight = 50 // height of the table's header cell
var border = 2; // 3d height of table's border
var cellspacing = 4; // width of table's border
var headercolor = "midnightblue"; // color of table's header
var headersize = "+3"; // size of tables header font
var colwidth = 60; // width of columns in table
var daycellheight = 25; // height of cells containing days of the week
var daycolor = "darkblue"; // color of font representing week days
var cellheight = 40; // height of cells representing dates in the calendar
var todaycolor = "red"; // color specifying today's date in the calendar
var timecolor = "purple"; // color of font representing current time

// create basic table structure
var text = ""; // initialize accumulative variable to empty string
text += '<table border=' + border + ' cellspacing=' + cellspacing + '>'; // table settings
text += '<th colspan=7 height=' + 10 + '>'; // create table header cell
text += '<font color="' + headercolor + '" size=' + headersize + '>'; // set font for table header
text += monthname + ' ' + year;
text += '</font>'; // close table header's font settings
text += '</th>'; // close header cell

// variables to hold constant settings
var opencol = '<td width=' + colwidth + ' height=' + daycellheight + '>';
opencol += '<font color="' + daycolor + '">';
var closecol = '</font></td>';

// create array of abbreviated day names
var weekday = new array(7);
weekday[0] = "sun";
weekday[1] = "mon";
weekday[2] = "tues";
weekday[3] = "wed";
weekday[4] = "thu";
weekday[5] = "fri";
weekday[6] = "sat";

// create first row of table to set column width and specify week day
text += '<tr align="center" valign="center">';
for (var daynum = 0; daynum < 7; ++daynum) {
text += opencol + weekday[daynum] + closecol;
}
text += '</tr>';

// declaration and initialization of two variables to help with tables
var dayofmonth = 1;
var curcell = 1;

for (var row = 1; row <= math.ceil((lastdate + firstday - 1) / 7); ++row) {
text += '<tr align="right" valign="top">';
for (var col = 1; col <= 7; ++col) {
if ((curcell < firstday) || (dayofmonth > lastdate)) {
text += '<td></td>';
curcell++
} else {
if (dayofmonth == date) { // current cell represents today's date
text += '<td><today:day value=' + dayofmonth + '></today:day></td>';
} else {
text += '<td><anyday:day value=' + dayofmonth + '></anyday:day></td>';
}
dayofmonth++;
}
}
text += '</tr>';
}

// close all basic table tags
text += '</table>';
text += '</center>';

// print accumulative html string
document.write(text);
}

// -->
</script>
</body>
</html>



编辑:黑鹰 [发送给好友] [打印本页] [关闭窗口] [返回顶部]
上一篇:样 式 表 全 接 触(3)
下一篇:html组件之:anyday 和 today htc(2)
转载请注明来源:www.iyit.net
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。

 相关文章
最新更新 热点排行 推荐新闻
在 css 中关于字体处理效果的思考
html 初学者指南
showmodelessdialog()使用详解
仿 office 2003 的工具条
跟我学xsl(一)
在 css 中关于字体处理效果的思考
html 初学者指南
showmodelessdialog()使用详解
仿 office 2003 的工具条
跟我学xsl(一)
跟我学xsl(二)
利用css改善网站可访问性
用js封装的时间设置器
ubb 转换函数演示
用 onerror 获取错误信
一个优秀的超链接鼠标悬停提示css+js
使用dom创建xml
*.htc 文件的简单介绍
html 初学者指南
读取符合rss2.0规范的xml文档
优秀公益广告作品欣赏(8)
java数据类型转换
windows xp专业版iis连接数的更改
新开放qq免费挂级网站
优秀公益广告作品欣赏(7)
免费在qq上看在线电影电视听音乐
office2007简体中文版浮出水面 美图抢
qq珊瑚虫外挂4.0版本发布!
web服务器配置全攻略(三)
免费把qq炫铃设为本机qq的系统提示音
msn8.0下载
如何在win20003中更好的玩游戏
qq收费头像免费使用的方法 
微软将在华推分期付款,充值卡pc 可低价
 amd处理器am2测试 风扇竟运行7分钟
exeplorer.exe错误的问题的总结、解决
asp.net 2.0 中的异步页功能应用
硬盘坏道修复及数据恢复宝典
免费登录搜索引擎入口大全
搜索引擎注册九大秘法
 友情链接
设置首 页 - 版权声明 - 广告服务 - 关于我们 - 联系我们 - 友情连接
copyrights © 2004-2006 iyit.net all rights reserved.
网站合作、广告联系qq:147007642、466949678
易特网络技术 点击这里给我发消息