爱易网
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特效
标准的输入框检测
标准的输入框检测
日期:2014-05-18 浏览次数:20187 次
欢迎光临爱易网网页脚本特效中心,点击运行按钮演示特效:
以下是程序代码
脚本说明: 把如下代码加入区域中 <script Language="JavaScript"> <!-- function FrontPage_Form1_Validator(theForm) { if (theForm.info1.value == "") { alert("请在 \"用户名\" 域中输入值。"); theForm.info1.focus(); return (false); } if (theForm.info1.value.length < 1) { alert("在 \"用户名\" 域中,请至少输入 1 个字符。"); theForm.info1.focus(); return (false); } if (theForm.info1.value.length > 10) { alert("在 \"用户名\" 域中,请最多输入 10 个字符。"); theForm.info1.focus(); return (false); } if (theForm.info7.value == "") { alert("请在 \"出生年\" 域中输入值。"); theForm.info7.focus(); return (false); } if (theForm.info7.value.length < 4) { alert("在 \"出生年\" 域中,请至少输入 4 个字符。"); theForm.info7.focus(); return (false); } if (theForm.info7.value.length > 4) { alert("在 \"出生年\" 域中,请最多输入 4 个字符。"); theForm.info7.focus(); return (false); } var checkOK = "0123456789-.,"; var checkStr = theForm.info7.value; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if (ch == ".") { allNum += "."; decPoints++; } else if (ch != ",") allNum += ch; } if (!allValid) { alert("在 \"出生年\" 域中,只能输入 数字 个字符。"); theForm.info7.focus(); return (false); } if (decPoints > 1) { alert("请在 info7 域中输入一个有效数字。"); theForm.info7.focus(); return (false); } var chkVal = allNum; var prsVal = parseFloat(allNum); if (chkVal != "" && !(prsVal >= "1940" && prsVal <= "2000")) { alert("请在 \"出生年\" 域中输入值 大于或等于 1940 与 小于或等于 2000。"); theForm.info7.focus(); return (false); } if (theForm.info8.value == "") { alert("请在 \"出生月份\" 域中输入值。"); theForm.info8.focus(); return (false); } if (theForm.info8.value.length < 1) { alert("在 \"出生月份\" 域中,请至少输入 1 个字符。"); theForm.info8.focus(); return (false); } if (theForm.info8.value.length > 2) { alert("在 \"出生月份\" 域中,请最多输入 2 个字符。"); theForm.info8.focus(); return (false); } var checkOK = "0123456789-.,"; var checkStr = theForm.info8.value; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if (ch == ".") { allNum += "."; decPoints++; } else if (ch != ",") allNum += ch; } if (!allValid) { alert("在 \"出生月份\" 域中,只能输入 数字 个字符。"); theForm.info8.focus(); return (false); } if (decPoints > 1) { alert("请在 info8 域中输入一个有效数字。"); theForm.info8.focus(); return (false); } var chkVal = allNum; var prsVal = parseFloat(allNum); if (chkVal != "" && !(prsVal >= "1" && prsVal <= "12")) { alert("请在 \"出生月份\" 域中输入值 大于或等于 1 与 小于或等于 12。"); theForm.info8.focus(); return (false); } if (theForm.info9.value == "") { alert("请在 \"出生日期\" 域中输入值。"); theForm.info9.focus(); return (false); } if (theForm.info9.value.length < 1) { alert("在 \"出生日期\" 域中,请至少输入 1 个字符。"); theForm.info9.focus(); return (false); } if (theForm.info9.value.length > 2) { alert("在 \"出生日期\" 域中,请最多输入 2 个字符。"); theForm.info9.focus(); return (false); } var checkOK = "0123456789-,"; var checkStr = theForm.info9.value; var
上一篇:狡猾的按钮特效
下一篇:屏蔽页面的Ctrl-C功能
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
美国政府关门可能影响去哪儿等公司IPO
国内首个大数据系列指数今日发布
一大波智能路由器正在袭来:小米、360、极路由大PK
传诺基亚Lumia928下月推出 将与iPhone5看齐
广电地方营业厅的一句“罚停”,暴露出了他们的本质
亚马逊Fire Phone:请别拿我跟苹果三星比
中国移动4G资费调整方案6月1日起正式实施
谁说黑莓没救?他们在悄悄地深耕企业级市场,在这个领域,苹果三星算什么,他们远远不是黑莓的对手
Android应用审核乱象:诈骗软件冲上排行榜首
推荐阅读
更多>
充斥着假消息负能量的“秘密”缺乏普适性
iOS7拖累iPad 5、iPad mini2发布 传十月份推出
同为70前后人,马云为什么总是像外星人那么瘦
广电总局回应美剧下架:不是所有信息可公开
打车软件火了 恶性循环来了
解读苹果收购Beats背后动机:库克在想什么?
三大运营商获通知大减营销费 传3年减400多亿
众贷网满月开张 网络金融监管再受质疑
“宽带中国”计划已正式上升为国家战略
中国邮政与阿里合作:邮政网点可做网购自提点
继续涨:微博IPO第二交易日 收盘大涨11.71%
虚拟运营商温度有多高?降温OR升温内外有别
迅雷欲3300万美元收购金山快盘 预计9月完成
中国移动承诺再降4G资费 网络漫游至50个国家
中移动业绩增长趋缓 目光转向海外市场
快播灭了,还有西瓜:视频网站的灰色江湖还在
开个房刷个卡全世界都知道个人隐私成公开秘密
窗口期:还有哪些互联网公司可能今年IPO?
杨元庆去年总薪酬1.33亿元
第二梯队也PK:当1号店“遇上”京东手机节