爱易网
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 浏览次数:20248 次
欢迎光临爱易网网页脚本特效中心,点击运行按钮演示特效:
以下是程序代码
<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
上一篇:狡猾的按钮特效
下一篇:非常实用的作为表单输入日期选择的特效
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
FDD牌照短期不会发放 联通电信暗自提速建网
iPhone5S组件曝光 印证杀手级功能存在
“扫黄打非”下9158否认遭整顿
去看看外面的世界吧!别窝里斗了,中国在线旅游商们
戴尔新CEO名单曝光:惠普甲骨文高管在列
MIUI,有了它小米就无惧对手
AMD Q1净亏1.46亿美元 转战SOC拥抱ARM求变
阿朗力避步北电后尘 急切停止自我革新
开个房刷个卡全世界都知道个人隐私成公开秘密
推荐阅读
更多>
地图导航骤起杀机 百度高德重新定义商业模式
打车App就是下一个团购骗局!?
NoomWeight减肥
微信企业号必须搬走四座大山,否则只能铩羽而归!
诺基亚若没加入微软,只不过是另一个HTC而已
赴美开店,阿里11Main准备好了吗?
郭美美事件推手被抓 “秦火火”拷问网络底线
永不磨灭的九大尖端编程语言
微信今天大面积崩溃 腾讯:因光缆施工被挖断
历史惊人相似:如今的库克 曾经的鲍尔默
携程收买酷讯成定局:转型互联网+投资
巨人网络回应央视 否认应用黑客停止诈骗
流浪汉高考状元终于找到工作:月薪3000做程序员很满意
微软史上最大规模裁员,一半诺基亚员工
佳能利润大跌三成 智能终端倒逼相机厂商转型
史玉柱卸任巨人网络CEO 继位人选引猜想
苏宁易购成世界最慢电商 专家称其涉嫌违约
三星起诉LG在冰箱广告中玷污其企业笼统
微软不会被颠覆
传苹果与雅虎协作信息提供 进一步摆脱谷歌