




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Javascript程序和实例代码,JS程序,注册表单验证常用js代码, /验证是否为数字function IsDigit(cCheck)return (0=cCheck) /验证是否为英文字母function IsAlpha(cCheck)return (a=cCheck) if (username = )alert(请输入用户名);document.form1.username.focus();return false; 验证:用户名必须为英文字母、数字以及_组成 for (nIndex=0; nIndexusername.length; nIndex+)cCheck = username
2、.charAt(nIndex);if (!(IsDigit(cCheck) | IsAlpha(cCheck) | cCheck=_ ) alert(用户名只能使用字母、数字以及-、_和.,并且不能使用中文);document.sform1.id.focus();return false;,/验证密码字段是否为空password = document.form1.password.value;if (password = )alert(请输入登陆密码);document.form1.password.focus();return false; /验证密码字段两次输入是否相同 password1
3、 = document.form1.password1.value;if (passwordpassword1) alert(重复密码与登陆密码不相同);document.form1.password.focus();document.form1.password1.focus();return false;if (passwordpassword1) alert(重复密码与登陆密码不相同);document.sform1.password.focus();document.sform1.password1.focus();return false;,/验证email字段是否为空 if (do
4、cument.form1.email.value = )alert(请输入您的E-MAIL地址);document.form1.email.focus();return false; /验证email字段输入是否合法email=document.form1.email.value;emailerr=0for (i=0; i 5) emailerr=emailerr+1if (emailerr != 1)alert(请输入正确的E-MAIL地址);document.form1.email.focus();return false;,if (document.form1.checkask.valu
5、e=)alert(密码提示问题不能为空);document.form1.checkask.focus();return false;if (document.form1.checkans.value=)alert(您的密码提示问题答案不能为空);document.form1.checkans.focus();return false;return true;,js用户名与密码验证程序,function check(form) if(form.ftpuser.value=) alert(请输入FTP用户名!); return false; if(form.ftppass.value=) aler
6、t(请输入FTP密码!); return false; if(form.randNum.value=) alert(请输入验证码!); return false; return true;/-,html代码 FTP帐号,Javascript应用技巧,网页特效 怎么用javascript禁止查看源代码 把如下代码加入区域中,把如下代码加入区域中 加密页面源代码脚本 将你的页面源代码粘贴在下面的框内,要包括所有的标签例如html , head, body等。 以上是转换好的代码,将他们加入如下脚本的引号区内,就是加密后的HTML了!, var Words = /put your cripto co
7、de there function SetNewWords() var NewWords; NewWords = unescape(Words); document.write(NewWords); SetNewWords(); / - ,网页禁止复制代码 -防止复制的js-function disableselect(e)return falsefunction reEnable()return truefile:/if IE4+document.onselectstart=new Function (return false)file:/if NS6if (window.sidebar)d
8、ocument.onmousedown=disableselectdocument.onclick=reEnable,-防止下载的js(禁止另存为)-,-下面是防止右键的js:-!-if (window.Event) document.captureEvents(Event.MOUSEUP); function nocontextmenu() event.cancelBubble = trueevent.returnValue = false;return false;function norightclick(e) if (window.Event) if (e.which = 2 | e.
9、which = 3) return false;else if (event.button = 2 | event.button = 3) event.cancelBubble = true event.returnValue = false;,return false; document.oncontextmenu = nocontextmenu; / for IE5+document.onmousedown = norightclick; / for all others/- 禁止选择文本 var omitformtags=input, textarea, select omitformtags=omitformtags.join(|) function disableselect(e) if (omitformtags.indexOf(e.target.tagName.toLowerCase()=-1) return false ,function reEnable() return true if (typeof document.ons
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025至2030年中国建筑脚手架行业市场预测与投资策略分析报告
- 2025年高速真空泵油项目可行性研究报告
- 房地产行业购房合同免责声明
- 共享经济下城市物业租赁协议
- 古代诗歌的意象与意境解析
- 2025年钻井液用增粘剂项目可行性研究报告
- 2025年金属牙项目可行性研究报告
- 2025年酒店勿扰触摸门铃项目可行性研究报告
- 《古代诗歌韵律之美高一诗歌欣赏教学方案》
- 2025年起重机保护箱项目可行性研究报告
- CET46大学英语四六级单词EXCEL版
- 2022年南通市特殊教育岗位教师招聘考试笔试试题及答案解析
- GB/T 4857.7-2005包装运输包装件基本试验第7部分:正弦定频振动试验方法
- GB/T 3051-2000无机化工产品中氯化物含量测定的通用方法汞量法
- GB/T 13936-1992硫化橡胶与金属粘接拉伸剪切强度测定方法
- GB/T 13888-2009在开磁路中测量磁性材料矫顽力的方法
- GB/T 12689.1-2010锌及锌合金化学分析方法第1部分:铝量的测定铬天青S-聚乙二醇辛基苯基醚-溴化十六烷基吡啶分光光度法、CAS分光光度法和EDTA滴定法
- GB/T 11344-2021无损检测超声测厚
- 海南省2023普通高中基础会考试卷通用技术科试题及答案
- TPM管理基础知识培训课件
- 抗菌药物临床应用指导原则(最新)
评论
0/150
提交评论