转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 站长学院 >> Web开发 >> 正文
[原创]ASP.net下的前台日历控件源代码(不刷新页面)         ★★★★

[原创]ASP.net下的前台日历控件源代码(不刷新页面)

作者:闵涛 文章来源:闵涛的学习笔记 点击数:2499 更新时间:2009/4/23 10:43:14

#region 声明
//----------------------------------------------------------------------
//
// 作者: 李淼(Nick.Lee)
//
// ASP.net下的前台日历控件源代码(不刷新页面)

// 时间:2005-3-15

// boyorgril@msn.com
// QQ:16503096
//注意:引用请标明出处,谢谢
//----------------------------------------------------------------------
#endregion

js脚本
//==================================================== 参数设定部分 =======================================================
var bMoveable=true;  //设置日历是否可以拖动
var _VersionInfo=""         //版本信息

//==================================================== WEB 页面显示部分 =====================================================
var strFrame;  //存放日历层的HTML代码
document.writeln(''''<iframe id=nickDateLayer scrolling=0 frameborder=0 style="position: absolute; width: 144; height: 211; z-index: 9998; display: none"></iframe>'''');
strFrame=''''<style>'''';
strFrame+=''''INPUT.button{BORDER-RIGHT: #9496E1 1px solid;BORDER-TOP: #9496E1 1px solid;BORDER-LEFT: #9496E1 1px solid;'''';
strFrame+=''''BORDER-BOTTOM: #9496E1 1px solid;BACKGROUND-COLOR: #fff8ec;font-family:宋体;}'''';
strFrame+=''''TD{FONT-SIZE: 9pt;font-family:宋体;}'''';
strFrame+=''''</style>'''';
strFrame+=''''<scr'''' + ''''ipt>'''';
strFrame+=''''var datelayerx,datelayery; /*存放日历控件的鼠标位置*/'''';
strFrame+=''''var bDrag; /*标记是否开始拖动*/'''';
strFrame+=''''function document.onmousemove() /*在鼠标移动事件中,如果开始拖动日历,则移动日历*/'''';
strFrame+=''''{if(bDrag && window.event.button==1)'''';
strFrame+='''' {var DateLayer=parent.document.all.nickDateLayer.style;'''';
strFrame+=''''  DateLayer.posLeft += window.event.clientX-datelayerx;/*由于每次移动以后鼠标位置都恢复为初始的位置,因此写法与div中不同*/'''';
strFrame+=''''  DateLayer.posTop += window.event.clientY-datelayery;}}'''';
strFrame+=''''function DragStart()  /*开始日历拖动*/'''';
strFrame+=''''{var DateLayer=parent.document.all.nickDateLayer.style;'''';
strFrame+='''' datelayerx=window.event.clientX;'''';
strFrame+='''' datelayery=window.event.clientY;'''';
strFrame+='''' bDrag=true;}'''';
strFrame+=''''function DragEnd(){  /*结束日历拖动*/'''';
strFrame+='''' bDrag=false;}'''';
strFrame+=''''</scr'''' + ''''ipt>'''';
strFrame+=''''<div style="z-index:9999;position: absolute; left:0; top:0;" onselectstart="return false"><span id=tmpSelectYearLayer  style="z-index: 9999;position: absolute;top: 3; left: 19;display: none"></span>'''';
strFrame+=''''<span id=tmpSelectMonthLayer  style="z-index: 9999;position: absolute;top: 3; left: 78;display: none"></span>'''';
strFrame+=''''<table border=1 cellspacing=0 cellpadding=0 width=142 height=160 bordercolor=#9496E1 bgcolor=#9496E1 >'''';
strFrame+=''''  <tr ><td width=142 height=23  bgcolor=#FFFFFF><table border=0 cellspacing=1 cellpadding=0 width=140  height=23>'''';
strFrame+=''''      <tr align=center ><td width=16 align=center bgcolor=#9496E1 style="font-size:12px;cursor: hand;color: #FFFFFF" '''';
strFrame+=''''        onclick="parent.nickPrevM()" title="向前翻 1 月" ><b >&lt;</b>'''';
strFrame+=''''        </td><td width=60 align=center style="font-size:12px;cursor:default"  '''';
strFrame+=''''onmouseover="style.backgroundColor=\''''#C6C7EF\''''" onmouseout="style.backgroundColor=\''''white\''''" '''';
strFrame+=''''onclick="parent.tmpSelectYearInnerHTML(this.innerText.substring(0,4))" title="点击这里选择年份"><span  id=nickYearHead></span></td>'''';
strFrame+=''''<td width=48 align=center style="font-size:12px;cursor:default"  onmouseover="style.backgroundColor=\''''#C6C7EF\''''" '''';
strFrame+='''' onmouseout="style.backgroundColor=\''''white\''''" onclick="parent.tmpSelectMonthInnerHTML(this.innerText.length==3?this.innerText.substring(0,1):this.innerText.substring(0,2))"'''';
strFrame+=''''        title="点击这里选择月份"><span id=nickMonthHead ></span></td>'''';
strFrame+=''''        <td width=16 bgcolor=#9496E1 align=center style="font-size:12px;cursor: hand;color: #FFFFFF" '''';
strFrame+=''''         onclick="parent.nickNextM()" title="向后翻 1 月" ><b >&gt;</b></td></tr>'''';
strFrame+=''''    </table></td></tr>'''';
strFrame+=''''  <tr ><td width=142 height=18 >'''';
strFrame+=''''<table border=1 cellspacing=0 cellpadding=0 bgcolor=#9496E1 '''' + (bMoveable? ''''onmousedown="DragStart()" onmouseup="DragEnd()"'''':'''''''');
strFrame+='''' BORDERCOLORLIGHT=#9496E1 BORDERCOLORDARK=#FFFFFF width=140 height=20  style="cursor:'''' + (bMoveable ? ''''move'''':''''default'''') + ''''">'''';
strFrame+=''''<tr  align=center valign=bottom><td style="font-size:12px;color:#FFFFFF" >日</td>'''';
strFrame+=''''<td style="font-size:12px;color:#FFFFFF" >一</td><td style="font-size:12px;color:#FFFFFF" >二</td>'''';
strFrame+=''''<td style="font-size:12px;color:#FFFFFF" >三</td><td style="font-size:12px;color:#FFFFFF" >四</td>'''';
strFrame+=''''<td style="font-size:12px;color:#FFFFFF" >五</td><td style="font-size:12px;color:#FFFFFF" >六</td></tr>'''';
strFrame+=''''</table></td></tr>'''';
strFrame+=''''  <tr ><td width=142 height=120 >'''';
strFrame+=''''    <table border=1 cellspacing=2 cellpadding=0 BORDERCOLORLIGHT=#9496E1 BORDERCOLORDARK=#FFFFFF bgcolor=#fff8ec width=140 height=120 >'''';
var n=0; for (j=0;j<5;j++){ strFrame+= '''' <tr align=center >''''; for (i=0;i<7;i++){
strFrame+=''''<td width=20 height=20 id=nickDay''''+n+'''' style="font-size:12px"  onclick=parent.nickDayClick(this.innerText,0)></td>'''';n++;}
strFrame+=''''</tr>'''';}
strFrame+=''''      <tr align=center >'''';
for (i=35;i<39;i++)strFrame+=''''<td width=20 height=20 id=nickDay''''+i+'''' style="font-size:12px"  onclick="parent.nickDayClick(this.innerText,0)"></td>'''';
strFrame+=''''        <td colspan=3 align=right ><span onclick=parent.closeLayer() style="font-size:12px;cursor: hand"'''';
strFrame+=''''          title="'''' + _VersionInfo + ''''"><u>关闭</u></span>&nbsp;</td></tr>'''';
strFrame+=''''    </table></td></tr><tr ><td >'''';
strFrame+=''''        <table border=0 cellspacing=1 cellpadding=0 width=100%  bgcolor=#FFFFFF>'''';
strFrame+=''''          <tr ><td  align=left><input  type=button class=button value="<<" title="向前翻 1 年" onclick="parent.nickPrevY()" '''';
strFrame+=''''             onfocus="this.blur()" style="font-size: 12px; height: 20px"><input  class=button title="向前翻 1 月" type=button '''';
strFrame+=''''             value="< " onclick="parent.nickPrevM()" onfocus="this.blur()" style="font-size: 12px; height: 20px"></td><td '''';
strFrame+=''''              align=center><input  type=button class=button value=今天 onclick="parent.nickToday()" '''';
strFrame+=''''             onfocus="this.blur()" title="当前日期" style="font-size: 12px; height: 20px; cursor:hand"></td><td '''';
strFrame+=''''              align=right><input  type=button class=button value=" >" onclick="parent.nickNextM()" '''';
strFrame+=''''             onfocus="this.blur()" title="向后翻 1 月" class=button style="font-size: 12px; height: 20px"><input '''';
strFrame+=''''              type=button class=button value=">>" title="向后翻 1 年" onclick="parent.nickNextY()"'''';
strFrame+=''''             onfocus="this.blur()" style="font-size: 12px; height: 20px"></td>'''';
strFrame+='''

[1] [2] [3]  下一页


[C语言系列]NET 中C#的switch语句的语法  [系统软件]托拽Explore中的文件到VB.net的窗口
[系统软件]Boost库在XP+Visual C++.net中的安装  [常用软件]新配色面板:Paint.Net3.0RC1官方下载
[常用软件]用内建的“Net Meeting”聊天  [VB.NET程序]Henry的VB.NET之旅(三)—共享成员
[VB.NET程序]Henry的VB.NET之旅(二)—构造与析构  [VB.NET程序]Henry的VB.NET之旅(一)—失踪的窗体
[VB.NET程序]在托盘上显示Balloon Tooltip(VB.NET)  [VB.NET程序]Henry手记-VB.NET中动态加载Treeview节点(二)
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Web开发  · 网页制作
    · 平面设计  · 网站运营
    · 网站推广  · 搜索优化
    · 建站心得  · 站长故事
    · 互联动态
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台