帮酷LOGO
  • 显示原文与译文双语对照的内容
文章标签:用户  availability  USE  asp  


Screenshot - screenshot1.gif

介绍

今天,每个人都想imporve网站的性能,在谷歌 换句话说,密码强度,如你所见,当我们在密码字段输入任何字符,密码强度检查 例如 弱,强等非常快,所以我添加了用户名的相同功能的可用性

背景

( 可选) 在本文中有任何背景,可能是有用的,比如介绍介绍的基本想法。

使用代码

今天,每个人都想imporve网站的性能,在谷歌 换句话说,密码强度,如你所见,当我们在密码字段输入任何字符,密码强度检查 例如 弱,强等非常快,所以我添加了用户名的相同功能的可用性

代码块应设置为样式"格式化格式",如下所示:

<scriptlanguage="javascript">function put(param)
{
 document.form1.username.value="" document.form1.username.value=param
 document.getElementById("Available").innerHTML = "";
}function OnChangedUsername()
{
 if(document.form1.username.value == "")
 {
 document.form1.btnCheckAvailability.disabled = true;
 document.getElementById("Available").innerHTML ="" }
 else {
 document.form1.btnCheckAvailability.disabled = false;
 }
}function OnCheckAvailability()
{
 if(window.XMLHttpRequest)
 {
 oRequest = new XMLHttpRequest();
 }
 elseif(window.ActiveXObject)
 {
 oRequest = new ActiveXObject("Microsoft.XMLHTTP");
 }
 oRequest.open("POST", "available.asp", true);
 oRequest.onreadystatechange = UpdateCheckAvailability;
 oRequest.setRequestHeader("Content-Type", "application/x-www- form-urlencoded");
 oRequest.send("strCmd=availability&strUsername=" + document.form1.username.value);
}function UpdateCheckAvailability()
{
 if(oRequest.readyState == 4)
 { 
 if(oRequest.status == 200)
 {
 document.getElementById("Available").innerHTML = oRequest.responseText;
 }
 else {
 document.getElementById("Available").innerHTML = "Asychronous Error";
 } 
 }
}function validate(form1)
{//****************************************************if (form1.username.value.length<1)
 {
 alert("Please enter username!");
 form1.username.focus();
 form1.username.select();
 return(false);
 }elseif ((form1.username.value.indexOf("*")!=-1)||
 (form1.username.value.indexOf("!")!=-1)||(form1.username.value.indexOf("@")!=-1)||
 (form1.username.value.indexOf("$")!=-1)||(form1.username.value.indexOf("%")!=-1)||
 (form1.username.value.indexOf(&quot;^")!=-1)||
 (form1.username.value.indexOf("#")!=-1)||(form1.username.value.indexOf("=")!=-1)||
 (form1.username.value.indexOf("-")!=-1)||(form1.username.value.indexOf("[")!=-1)||
 (form1.username.value.indexOf("]")!=-1)||(form1.username.value.indexOf("{")!=-1)||
 (form1.username.value.indexOf("}")!=-1)||(form1.username.value.indexOf("+")!=-1)||
 (form1.username.value.indexOf("~")!=-1)||(form1.username.value.indexOf("?")!=-1)||
 (form1.username.value.indexOf("|")!=-1)||(form1.username.value.indexOf(">")!=-1)||
 (form1.username.value.indexOf("<")!=-1)||(form1.username.value.indexOf("")!=-1))
 { 
 alert("Special characters and spaces are not allowed" );
 form1.username.focus();
 form1.username.select();
 return(false);
 }
else if (form1.username.value.length>30)
 {
 alert("Username must be less than thirty characters!")
 form1.username.focus();
 form1.username.select();
 return(false);
 }
}
</script>

记住使用语言下拉列表设置代码段的语言。

使用"var"按钮来包装 <代码> 标签中的变量或者类名,如 this

Points of Interest

你在写代码的时候有没有学习过 interesting/fun/annoying? 你做了什么特别聪明的还是zany的?

历史记录

保持在这里进行的任何更改或者改进的运行更新。



文章标签:USE  asp  用户  availability  

Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语