Asp.NET Tutorials
Home
>
其他
> 几个有用的类,希望对大家有用
Categories
综合文章
(3442)
安装和部署
(14)
Asp.Net开发
(587)
C#语言
(604)
VB.Net语言
(44)
控件使用
(14)
WinForm应用
(95)
文件操作
(4)
算法与线程
(38)
报表/图表
(10)
Email专题
(18)
WebService
(20)
XML应用
(21)
网络与远程
(24)
ADO.Net
(57)
控件开发
(10)
安全与优化
(18)
Office编程
(20)
正则表达式
(19)
其他
(53)
移动开发
(13)
WCF/WPF
(3)
Hot archives
各种网页播放面板代码,MediaPlayer Replayer等
GB2312简体中文编码表
汉字编码简明对照表
Win2000忘记管理员密码时的综合解决方案
设计类经典资源一[转贴]
常用Html和JavaScript小技巧
精确到秒的倒计时代码javascript
用DIV+UL+LI生成表格
设计类经典资源二[转贴]
浅析Windows2000系统文件保护功能
设计类经典资源三[转贴]
input标签的高级限制级用法
CSS+DIV怎样实现提交表格效果
格式化数字函数FormatNumber
整理的AD/win2000技巧(60多个)
客户端如何更改FTP的密码
自动刷新页面
JScript中的事件函数
在SQL Server 2000中误删除了某些用户数据,如何进行恢复
Javascript实现浏览器菜单命令
Windows自启动程序十大藏身之所
解读Windows2000/XP系统服务
如何判断ACTIVEX控件是否下载
树型目录菜单
象QQ一样的自动伸缩菜单
JavaScript修改注册表的例子
xhtml,Div,css布局
EditPlus使用技巧集萃[转]
检测浏览器类型并用声音提示
不出提示窗口关闭窗口
SPAN和DIV的区别
实现打印设置与预览
文字从状态栏左冒出
自动展开的窗口
使窗口只第一次访问时弹出
GIF格式详解
单一表单的多个递交方案
为何要学JavaScript
网页常用小技巧
点击右键就弹出一个菜单
文字从状态栏右冒出
用Js判断输入的时间是否有效.
文字在状态栏逐字放入
跟随鼠标的彩色方格
windowsserver2003优化设置方法
几个有用的类,希望对大家有用
几个有用的类,希望对大家有用
几个有用的类,希望对大家有用
几个有用的类,希望对大家有用
几个有用的类,希望对大家有用
几个有用的类,希望对大家有用
几个有用的类,希望对大家有用。
From: 51js.com
Author:
zmm
1.日历
<style type="text/css"> #oContainer { width: 193px; padding: 3px; background-color: menu; border-left: buttonhighlight 1px solid; border-top: buttonhighlight 1px solid; border-right: buttonshadow 1px solid; border-bottom: buttonshadow 2px solid; } .DateTable { font: 10pt; word-break: break-all; } .WeekTd, .BlankTd { font: 10pt; border: 1px solid menu; } .Today { font: 10pt; color: red; cursor: hand; position: relative; left: 1px; top: 1px; border-left: 1px solid dimgray; border-top: 1px solid dimgray; border-right: 1px solid white; border-bottom: 1px solid white; } .MonthTd { font: 10pt; font-family: webdings; cursor: hand; border: 1px solid menu; zmm: expression(onmouseenter = function() { style.color = 'red'; }, onmouseout = function() { style.color = ''; }); } .SelectTd { border: 1px solid menu; } .over { position: relative; cursor: hand; border-right: 1px solid buttonshadow; border-bottom: 1px solid buttonshadow; border-left: 1px solid buttonhighlight; border-top: 1px solid buttonhighlight; } .out { border-left: 1px solid buttonface; border-top: 1px solid buttonface; border-right: 1px solid buttonface; border-bottom: 1px solid buttonface; } .down { position: relative; left: 1px; top: 1px; border-left: 1px solid dimgray; border-top: 1px solid dimgray; border-right: 1px solid white; border-bottom: 1px solid white; } </style> <script language="javascript"> var oDate = new Object(); function DateClass(_container) { this.author = '51JS.COM-ZMM'; this.version = 'Web Calendar 1.0'; this.container = _container; this.weekArr = ['日', '一', '二', '三', '四', '五', '六']; this.dateArr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; this.showTable = function(_year, _month) { this.container.innerHTML = this.getDateTable(_year, _month); } this.getDateTable = function(_year, _month) { if (this.checkArgs(_year, _month)) { _year = parseInt(this.checkDate(_year, _month).split('-')[0]); _month = parseInt(this.checkDate(_year, _month).split('-')[1]); this.Thead = '<table cellpadding="5" cellspacing="0" class="DateTable">\n'; this.Thead += '<tr><td align="center" class="MonthTd" onclick="oDate.showTable(' + _year + ', ' + eval(_month-1) + ');">3</td>'; this.Thead += '<td align="center" colspan="5" class="SelectTd"><select onchange="oDate.showTable(options[selectedIndex].value, ' + _month + ');">'; for (var i=1900; i<2101; i++) this.Thead += '<option value="' + i + '" ' + ((_year==i) ? 'selected' : '') + '>' + i + '年</option>'; this.Thead += '</select><select onchange="oDate.showTable(' + _year + ', options[selectedIndex].value);">'; for (var i=1; i<13; i++) this.Thead += '<option value="' + i + '" ' + ((_month==i) ? 'selected' : '') + '>' + i + '月</option>'; this.Thead += '</select></td>'; this.Thead += '<td align="center" class="MonthTd" onclick="oDate.showTable(' + _year + ', ' + eval(_month+1) + ');">4</td></tr>\n'; this.Thead += '<tr>'; for (var i=0; i<this.weekArr.length; i++) this.Thead += '<td align="center" class="WeekTd">' + this.weekArr[i] + '</td>'; this.Thead += '</tr>\n'; this.Tbody = '<tr>'; this.dateArr[1] = (!this.checkYear(_year)) ? 28 : 29 ; for (var i=0; i<this.firstPos(_year, _month); i++) this.Tbody += '<td class="BlankTd"></td>'; for (var i=1; i<=this.dateArr[_month-1]; i++) { if (this.firstPos(_year, _month) == 0) { if (i!=1 && i%7==1) this.Tbody += '</tr>\n<tr>'; } else { if ((i+this.firstPos(_year, _month))%7==1) this.Tbody += '</tr>\n<tr>'; } if (!this.today(_year, _month, i)) { this.Tbody += '<td align="center" class="out" onmouseover="className=\'over\';" onmouseout="className=\'out\';" onmousedown="className=\'down\';" onclick="oDate.showDateStr(' + _year + ', ' + _month + ', ' + i + ', \'' + this.weekArr[new Date(_year, _month-1, i).getDay()] + '\');">' + i + '</td>'; } else { this.Tbody += '<td align="center" class="Today" onclick="oDate.showDateStr(' + _year + ', ' + _month + ', ' + i + ', \'' + this.weekArr[new Date(_year, _month-1, i).getDay()] + '\');">' + i + '</td>'; } } for (var i=0; i<6-this.lastPos(_year, _month); i++) this.Tbody += '<td class="BlankTd"></td>'; this.Tbody += '</tr>\n'; this.TFoot = '</table>\n'; this.Table = this.Thead + this.Tbody + this.TFoot; return this.Table; } else { return 'Arguments Error!'; } } this.firstPos = function(_year, _month) { return new Date(_year, _month-1, 1).getDay(); } this.lastPos = function(_year, _month) { return new Date(_year, _month-1, this.dateArr[_month-1]).getDay(); } this.checkYear = function(_year) { return ((_year % 4 == 0) && (_year % 100 != 0)) || (_year % 400 == 0); } this.today = function(_year, _month, _date) { return (new Date().getFullYear() == _year) && (new Date().getMonth() == _month-1) && (new Date().getDate() == _date); } this.checkArgs = function(_year, _month) { if (_year<1900 || _year>2100) return false; if (_month<0 || _month>13) return false; return (!isNaN(_year) && !isNaN(_month)); } this.checkDate = function(_year, _month) { if (_month<1) { _year --; _month = 12; } if (_month>12) { _year ++; _month = 1; } return _year + '-' + _month; } this.showDateStr = function(_year, _month, _date, _week) { window.alert(_year + '年' + _month + '月' + _date + '日 星期' + _week); } } window.onload = function() { oDate = new DateClass(self.oContainer); oDate.showTable(new Date().getFullYear(), new Date().getMonth()+1); } </script> <div id="oContainer"></div></body></html>
Add by : Huobazi (2006-6-26:01:58)