<?php
?>
<textarea name=
"message"
rows=
"10"
cols=
"50"
onclick=
"checkUser()"
wrap=
"off"
>
Give message please.
</textarea>
<script language=
"JavaScript"
type=
"text/javascript"
>
var
xmlHttp;
function
createXMLHttpRequest() {
if
(window.XMLHttpRequest) {
xmlHttp =
new
XMLHttpRequest();
}
else
if
(window.ActiveXObject) {
xmlHttp =
new
ActiveXObject(
"Microsoft.XMLHTTP"
);
}
}
function
checkUser(){
createXMLHttpRequest();
url =
"action.php?check=ok&ran="
+Math.random();
method =
"GET"
;
xmlHttp.open(method,url,true);
xmlHttp.onreadystatechange = show;
xmlHttp.send(null);
}
function
show(){
if
(xmlHttp.readyState == 4){
if
(xmlHttp.status == 200){
var
text = xmlHttp.responseText;
alert(text);
exit
;
}
else
{
alert(
"response error code:"
+xmlHttp.status);
}
}
}
</script>
#action.php
if
(isset(
$_GET
[
'check'
])){
#mysql执行语句,检测用户是否存在
echo
"检验中……"
;
}
<br><font color=
"#e78608"
>------解决方案--------------------</font><br>