php+js+mysql设计的仿webQQ-<2>其他验证_PHP教程
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php+js+mysql设计的仿webQQ-<2>其他验证_PHP教程,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含5306字,纯文字阅读大概需要8分钟。
内容图文
![php+js+mysql设计的仿webQQ-<2>其他验证_PHP教程](/upload/InfoBanner/zyjiaocheng/176/74e2470dd61a4c8fbe31d80a20923c08.jpg)
<2>昵称验证2>
Js代码
[javascript]
function checkNickname(Nickname)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("error2").innerHTML="*"; //复位
if(Nickname.length==0)
{
document.getElementById("error2").innerHTML="*昵称不能为空!";
}
else
{
if(Nickname.length>16)
{
document.getElementById("error2").innerHTML="*昵称不要超过16个字符!";
}
else
{
document.getElementById("error2").innerHTML="*昵称可用!";
}
}
}
}
xmlhttp.open("GET","index.php",true);
xmlhttp.send(); //注意这里与邮箱验证的不同
}
function checkNickname(Nickname)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("error2").innerHTML="*"; //复位
if(Nickname.length==0)
{
document.getElementById("error2").innerHTML="*昵称不能为空!";
}
else
{
if(Nickname.length>16)
{
document.getElementById("error2").innerHTML="*昵称不要超过16个字符!";
}
else
{
document.getElementById("error2").innerHTML="*昵称可用!";
}
}
}
}
xmlhttp.open("GET","index.php",true);
xmlhttp.send(); //注意这里与邮箱验证的不同
}
<3>密码验证3>
Js代码
[javascript]
function checkPwd1(password1)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{ document.getElementById("error3").innerHTML="*";
document.getElementById("password2").value="";
document.getElementById("error4").innerHTML="*";
if(password1.length==0)
{
document.getElementById("error3").innerHTML="*密码不能为空!";
}
else
{
if(password1.length<6||password1.length>16)
{
document.getElementById("error3").innerHTML="*密码为6-16个字符!";
}
else
{
var reg=/[a-zA-Z0-9]/; //在js中使用正则表达式 www.2cto.com
if(reg.test(password1))
{
document.getElementById("error3").innerHTML="*密码可用!";
}
else
{
document.getElementById("error3").innerHTML="*密码不可用!";
}
}
}
}
}
xmlhttp.open("GET","index.php",true);
xmlhttp.send();
}
function checkPwd1(password1)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{ document.getElementById("error3").innerHTML="*";
document.getElementById("password2").value="";
document.getElementById("error4").innerHTML="*";
if(password1.length==0)
{
document.getElementById("error3").innerHTML="*密码不能为空!";
}
else
{
if(password1.length<6||password1.length>16)
{
document.getElementById("error3").innerHTML="*密码为6-16个字符!";
}
else
{
var reg=/[a-zA-Z0-9]/; //在js中使用正则表达式
if(reg.test(password1))
{
document.getElementById("error3").innerHTML="*密码可用!";
}
else
{
document.getElementById("error3").innerHTML="*密码不可用!";
}
}
}
}
}
xmlhttp.open("GET","index.php",true);
xmlhttp.send();
}
<4>重复密码验证4>
Js代码
[javascript]
function checkPwd2(password2)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{ document.getElementById("error4").innerHTML="*";
if(password2.length==0)
{
document.getElementById("error4").innerHTML="*请确认密码!";
}
else
{
if(password2!=document.getElementById("password1").value)
{
document.getElementById("error4").innerHTML="*两次密码输入不一致!";
}
else
{
document.getElementById("error4").innerHTML="*密码输入一致!";
}
}
}
}
xmlhttp.open("GET","index.php",true);
xmlhttp.send();
}
function checkPwd2(password2)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{ document.getElementById("error4").innerHTML="*";
if(password2.length==0)
{
document.getElementById("error4").innerHTML="*请确认密码!";
}
else
{
if(password2!=document.getElementById("password1").value)
{
document.getElementById("error4").innerHTML="*两次密码输入不一致!";
}
else
{
document.getElementById("error4").innerHTML="*密码输入一致!";
}
}
}
}
xmlhttp.open("GET","index.php",true);
xmlhttp.send();
}
怎么样,挺简单的吧!(未完待续)
摘自 wyzhangchengjin123
http://www.bkjia.com/PHPjc/478249.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478249.htmlTechArticle来看看其他验证是不是很简单啦! 2昵称验证 Js代码 [javascript] function checkNickname(Nickname) { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefo...
内容总结
以上是互联网集市为您收集整理的php+js+mysql设计的仿webQQ-&lt;2&gt;其他验证_PHP教程全部内容,希望文章能够帮你解决php+js+mysql设计的仿webQQ-&lt;2&gt;其他验证_PHP教程所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。