利用J**aScript模拟一个注册页面,使用h**TML制作,表单对象模拟注册页面,求大神

时间:2014.05.25 发布人:123阿斯1

利用J**aScript模拟一个注册页面,使用h**TML制作,表单对象模拟注册页面,求大神

已解决问题

谷歌123阿斯1用户在2014.05.25提交了关于“约基奇利用J**aScript模拟一个注册页面,使用h**TML制作,表单对象模拟注册页面,求大神”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2025-02-27T04:12:12。希望大家能够帮助她。

详细问题描述及疑问:期待您的答案,你无异于雪中送炭,让我感激涕零 !

希望以下的回答,能够帮助你。

第1个回答

用户名:假行家  

只是写了昵称密码确认密响蛋啊周季变表视妒码电子邮件地址
其余的自己写一下吧
就是这个格式
自己完成吧!
<html>
<head>
<metahttp-源响课殖鲁各济岁本equiv="C他这良宪施验杀林送ontent-Type"content="text/html;charset=utf-8"/>
<title>UntitledDocument</title>
<scriptlanguage="j**ascript">
functioncheckname(){
vardiv=document.getElementById("div1");
d存程五洋混iv.innerh**TML="";
varname1=document.form1.text1.value;
if(name1==""){
div.innerh**TML="姓名不能为空!";
document.for阿跑买m1.text1.focus实损雨出钱形质获();
returnfalse;
}
if(name1.length<4||nam息分立胜线e1.length>16){
d汽鸡和宣资板iv.innerh**TML="姓名输入的长令方领二点度4-16个字符根普雨蒸叶特王看住提!";
document.***.select();
returnfalse;
}
varcharname1=name1.toLowerCase();
f角剂值祖or(vari=0;i<name1.length;i++){
varcharna节义主等尔言米议季否理me=charna展某农笑me1.charAt(i);
i评降何行所阳叫f(!(charname>=0&&charname<=9)&&(!(charname>='a'&&c钟效委束低扬绍愿策适harname<='z'))&&(charname!='_')){
d之室杂iv.innerh**TML="姓名包含非法字母,只能包含字母,数意吃盟角而字,和下划线";
document.***.select();
returnfalse;
}
}
returntrue;
}
functioncheckpassword(){
vardiv=document.getElementById("div2");
div.innerh**TML="";
varpassword=document.form1.text2.value;
if(password==""){
div.innerh**TML="密码不位空!";
document.form1.text2.focus();
returnfalse;
}
if(password.length<4||password.length>12){
div.innerh**TML="密码长度4-12位";
document.***.select();
returnfalse;
}
returntrue;
}
functioncheckrepassword(){
vardiv=document.getElementById("div3");
div.innerh**TML="";
varpassword=document.form1.text2.value;
varrepass=document.form1.text3.value;
if(repass==""){
div.innerh**TML="密码不位空!";
document.form1.text3.focus();
returnfalse;
}
if(password!=repass){
div.innerh**TML="输入密码和确认密码长度不一致";
document.***.select();
returnfalse;
}
returntrue;
}
functioncheckEmail(){
vardiv=document.getElementById("div4");
div.innerh**TML="";
varemail=document.form1.text5.value;
varsw=email.indexOf("@",0);
varsw1=email.indexOf(".",0);
vartt=sw1-sw;
if(email.length==0){
div.innerh**TML="电子邮件不能位空";
document.form1.text5.focus();
returnfalse;
}
if(email.indexOf("@",0)==-1){
div.innerh**TML="电子邮件格式不正确,必须包含@符号!";
document.***.select();
returnfalse;
}
if(email.indexOf(".",0)==-1){
div.innerh**TML="电子邮件格式不正确,必须包含.符号!";
document.***.select();
returnfalse;
}
if(tt==1){
div.innerh**TML="邮件格式不对。@和.不可以挨着!";
document.***.select();
returnfalse;
}
if(sw>sw1){
div.innerh**TML="电子邮件格式不正确,@符号必须在.之前";
document.***.select();
returnfalse;
}
else{
returntrue;
}
returnture;
}
functioncheck(){
if(checkname()&&checkpassword()&&checkrepassword()&&checkEmail()){
returntrue;
}
else{
returnfalse;
}
}
</script>
</head>
<body>
<formname="form1"method="post"action="2.html"onsubmit="returncheck()">
<table>
<tr>
<td>
用户名:
</td>
<td>
<inputid="text1"type="text"name="text1"onblur="check()">
<divid="div1"style="display:inline">
</div>
</td>
</tr>
<tr>
<td>
密码:
</td>
<td>
<inputid="text2"type="password"name="text2"onblur="check()">
<divid="div2"style="display:inline">
</div>
</td>
</tr>
<tr>
<td>
确认密码:
</td>
<td>
<inputid="text3"type="password"name="text3"onblur="check()">
<divid="div3"style="display:inline">
</div>
</td>
</tr>
<tr>
<td>
电子邮件地址:
</td>
<td>
<inputid="text4"type="text"name="text4"onblur="check()">
<divid="div4"style="display:inline">
</div>
</td>
</tr>
<tralign="center">
<tdalign="center">
<inputtype="submit"value="提交"name="tect6"><inputtype="reset"value="重置"name="text7">
</td>
</tr>
</table>
</form>
</body>
</html>