In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces php how to use Ajax technology to detect user name, the article is very detailed, has a certain reference value, interested friends must read it!
1. Build the Ajax development framework with the following code
Var http_request = false;function createRequest (url) {/ / initialize the object and issue a XMLHttpRequest request http_request = false; if (window.XMLHttpRequest) {/ / Mozilla and other browsers http_request = new XMLHttpRequest (); if (http_request.overrideMimeType) {http_request.overrideMimeType ("text/xml") }} else if (window.ActiveXObject) {/ / IE browser try {http_request = new ActiveXObject ("Msxml2.XMLHTTP");} catch (e) {try {http_request = new ActiveXObject ("Microsoft.XMLHTTP") } catch (e) {}} if (! http_request) {alert ("cannot create XMLHTTP instance!"); return false;} http_request.onreadystatechange = alertContents / / specify response method http_request.open ("GET", url, true); / / issue HTTP request http_request.send (null) } function alertContents () {/ / process the information returned by the server if (http_request.readyState = = 4) {if (http_request.status = = 200) {alert (http_request.responseText);} else {alert ('error found on the page you requested');}
two。 Write the custom function checkname () of JavaScript to detect whether the user name is empty. If the user name is not empty, call the createRequest () method to send a request to detect the existence of the user name. The code is as follows:
Function checkname () {var username= form1.user.value; if (username== ") {window.alert (" Please enter a user name ");} else {createRequest ('action/checkname.php?username='+username+'&nocache='+new Date (). GetTime ());}}
3. Add "detect user name hyperlink" to the page
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.