3.js script: When the text box text is empty, the border is red; if the user name is janes, it will prompt "the user name already exists", otherwise it will prompt "the user name can be used".
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.jb51.net/-->$(function(){var txtname=$("#txtName");
/ /Text box style when entering text txtname.keyup(function(){ var name=$(this).val(); if(name=="") $(this ).addClass("txtName"); else $(this).removeClass("txtName"); }) //Verify whether the username is available when losing focus $("# txtName").blur(function() { var name=$(this).val(); $.get("validator1.aspx?name=" name,null,function(response ){ $("#result").html(response); })
})
})
4..aspx and .cs page codes are used to verify whether the user name is available to return the result.
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.jb51.net/-->public partial class Validator_validator1 : System.Web.UI.Page{
protected void Page_Load(object sender, EventArgs e) { string name = Request.QueryString["name"].ToString(); if (name == "janes") Response.Write("This user Name already exists! "); else Response.Write("This username can be used!");
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn