爱易网
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 浏览次数:20244 次
欢迎光临爱易网网页脚本特效中心,点击运行按钮演示特效:
以下是程序代码
<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
上一篇:狡猾的按钮特效
下一篇:非常实用的作为表单输入日期选择的特效
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
解析2014年阿里百度等五大互联网巨头深度布局
欧盟控诉苹果在爱尔兰非法进行税收交易
网友爆料称微软雇水军宣传主机Xbox One
北京电信推“0月租卡”,同网通话免费
二维码支付大战的号角注定已经吹响,尚需标准发放
酷派首抓4G时机大丰收,未来份额必降无疑
“扫黄打非”下9158否认遭整顿
Facebook财报前瞻:投资者仍信心不足
诺基亚培育低端机市场 迂回战术要挟中华酷联
推荐阅读
更多>
Facebook以“人”为本的名义占领安卓
小米盗版有理激怒乐视:提500部盗播证据猛追打
微软觊觎移动互联市场:手机未出渠道先行
IT时代周刊总编辑曹健:投资人刘志硕印象记
虚拟运营商流量不清零吸引用户 盈利待明
京东物流"最后一公里":颠覆阿里或者被阿里干掉
IT企业人才争夺战打响:员工待遇水涨船高
惠普中国转型只是缩影 未来开展不可预期
中国邮政与阿里合作:邮政网点可做网购自提点
工商下月将整治手机市场
清点:罗永浩推锤子ROM 小米打法遭模拟
苹果售后生态链乱象:供需失衡价钱不一
从3G牌照发放看中国4G规划效果
优酷土豆兼并一年:依然处于烧钱形状
2018年阿里云双11活动如何参加?1折优惠大攻略
中国雅虎邮箱今日关停 由盛及衰的背后
百度对糯米来说到底意味着什么?
9月1日起免征新能源汽车购置税
568倍PE,“长跑者”亚马逊的高估值之谜
诺基亚仍是第二大手机商:功用机有利可图