爱易网
IT新闻
IT新闻
爱易资讯
网站搭建
云虚拟主机教程
云服务器教程
Apache教程
IIS教程
Nginx教程
网站策划
站长文章
推广教程
淘宝客教程
网页设计
HTML教程
XHTML教程
CSS教程
HTML5教程
CSS3教程
JavaSript基础
JQuery教程
Node.js教程
前端技术
Ajax教程
Js特效
Xml教程
平面设计
页面UI设计
photoshop教程
程序开发
AI人工智能
Asp教程
Php教程
Asp.Net教程
Net Core教程
C#教程
Java教程
Jsp教程
开发技术
微信小程序教程
Uniapp开发教程
微信公众号开发
Andriod教程
IOS教程
DOS教程
Python教程
Docker教程
Windows Container教程
数据库
MSSQL教程
MySQL教程
Redis教程
Access教程
Oracle教程
数据库教程
操作系统
Linux教程
Windows教程
MAC教程
Cisco教程
交换机教程
防火墙教程
搜索
爱易网页
JS特效
一个表单日期输入的JS脚本 非常实用
一个表单日期输入的JS脚本 非常实用
日期:2014-05-18 浏览次数:20285 次
欢迎光临爱易网网页脚本特效中心,点击运行按钮演示特效:
以下是程序代码
<script language=javascript> var DS_x,DS_y; function dateSelector() //构造dateSelector对象,用来实现一个日历形式的日期输入框。 { var myDate=new Date(); this.year=myDate.getFullYear(); //定义year属性,年份,默认值为当前系统年份。 this.month=myDate.getMonth()+1; //定义month属性,月份,默认值为当前系统月份。 this.date=myDate.getDate(); //定义date属性,日,默认值为当前系统的日。 this.inputName=''; //定义inputName属性,即输入框的name,默认值为空。注意:在同一页中出现多个日期输入框,不能有重复的name! this.display=display; //定义display方法,用来显示日期输入框。 } function display() //定义dateSelector的display方法,它将实现一个日历形式的日期选择框。 { var week=new Array('日','一','二','三','四','五','六'); document.write("<style type=text/css>"); document.write(" .ds_font td,span { font: normal 12px 宋体; color: #000000; }"); document.write(" .ds_border { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }"); document.write(" .ds_border2 { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }"); document.write("</style>"); document.write("<input style='text-align:center;' id='DS_"+this.inputName+"' name='"+this.inputName+"' value='"+this.year+"-"+this.month+"-"+this.date+"' title=双击可进行编缉 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly>"); document.write("<button style='width:60px;height:18px;font-size:12px;margin:1px;border:1px solid #A4B3C8;background-color:#DFE7EF;' type=button onclick=this.nextSibling.style.display='block' onfocus=this.blur()>选择日期</button>"); document.write("<div style='position:absolute;display:none;text-align:center;width:0px;height:0px;overflow:visible' onselectstart='return false;'>"); document.write(" <div style='position:absolute;left:-60px;top:20px;width:142px;height:165px;background-color:#F6F6F6;border:1px solid #245B7D;' class=ds_font>"); document.write(" <table cellpadding=0 cellspacing=1 width=140 height=20 bgcolor=#CEDAE7 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'>"); document.write(" <tr align=center>"); document.write(" <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subYear(this) title='减小年份'><<</td>"); document.write(" <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subMonth(this) title='减小月份'><</td>"); document.write(" <td width=52%><b>"+this.year+"</b><b>年</b><b>"+this.month+"</b><b>月</b></td>"); document.write(" <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addMonth(this) title='增加月份'>></td>"); document.write(" <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addYear(this) title='增加年份'>>></td>"); document.write(" </tr>"); document.write(" </table>"); document.write(" <table cellpadding=0 cellspacing=0 width=140 height=20 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'>"); document.write(" <tr align=center>"); for(i=0;i<7;i++) document.write(" <td>"+week[i]+"</td>"); document.write(" </tr>"); document.write(" </table>"); document.write(" <table cellpadding=0 cellspacing=2 width=140 bgcolor=#EEEEEE>"); for(i=0;i<6;i++) { document.write(" <tr align=center>"); for(j=0;j<7;j++) document.write(" <td width=10% height=16 onmouseover=if(this.innerText!=''&&this.className!='ds_border2')this.className='ds_borde
上一篇:狡猾的按钮特效
下一篇:非常实用的作为表单输入日期选择的特效
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
惠普中国转型只是缩影 未来开展不可预期
成本效益全兼顾 混合云市场前景显现
窗口期:还有哪些互联网公司可能今年IPO?
工商下月将整治手机市场
虚拟运营商温度有多高?降温OR升温内外有别
迅雷高管解读财报:收购快盘可快速融入小米
这一次,微软将带给我们什么惊喜?
火一把就死: 百度魔图验证社交游戏衰亡宿命
传谷歌开发者大会发布Android 4.3 并非5.0版本
推荐阅读
更多>
携程整合去哪儿陷入僵局 欲联手老对手艺龙
苹果优势逐渐丧失 传即将推出廉价iPhone
三大运营商获通知大减营销费 传3年减400多亿
科技巨匠体验谷歌眼镜:戴上了就不想摘上去
中国移动4G资费调整方案6月1日起正式实施
微软与摩托罗拉授权协议涵盖Android和Chrome设备
亚马逊落户上海自贸区:美国货直邮中国
只有切到刚需痛点,漫画APP才能走下去
猎豹移动上市押海外市场 与小米有合作空间
电信资费新政:三巨头压力大 短期降价仍有争议
八位知名设计师评iOS7:新鲜但复杂
同为70前后人,马云为什么总是像外星人那么瘦
墨迹天气:产品创新以攻为守方能对抗巨头
阿里物流搭上邮政:京东,我们在终点等你!
手游市场乱象丛生 受资本热捧野蛮成长
Facebook思科联手推免费WiFi 欲覆盖全美
评论:阿里为什么不试着收购一家香港媒体呢
虚拟运营商流量不清零吸引用户 盈利待明
微软小冰复活再战移动端:改与米聊、易信和触宝合作
中国移动承诺再降4G资费 网络漫游至50个国家