| The code is as follows |
Copy Code |
<script type= "Text/javascript" >
function Showhint (str)
{
var xmlhttp;
if (str.length==0)
{
document.getElementById ("Txthint"). Innerhtml= "Sorry, your username cannot be empty";
Return
}
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 ("Txthint"). Innerhtml=xmlhttp.responsetext;
}
}
Xmlhttp.open ("Get", "check_name.aspx?q=" +str,true);
Xmlhttp.send ();
}<input id= "Tuname" runat= "onblur=" Showhint (this.value) "style=" font-size:20px; "class=" texbox15 "/>"
<asp:label id= "Txthint" runat= "Server" font-size= "13px" forecolor= "#33CC33" ></asp:Label>
|
Beginner Ajax Feel this effect is very practical
| The code is as follows |
Copy Code |
|
String qq = request.querystring["Q"]. ToString ();
String sql = "SELECT * from Cc_base_info where login_name= '" + QQ + "'";
CLASSDB db = new Classdb ();
SqlDataReader dr = Db.returndr (SQL);
if (Dr. Read ())
{
Response.Write ("<a style= ' color:red ' >" + "Sorry, the username already exists!" + "</a>");
}
Else
{
Response.Write ("<a style= ' Color:green ' >" + "Congratulations, the user name can be registered!" + "</a>");
}
|
Here is a simple to determine whether the user name is available for the operation, but also share with you. Take a note, by the way.