Client code mouseover. php
Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> mouse suspension test </title>
</Head>
<Script type = "text/javascript" language = "javascript">
Var xmlHttp;
Function createXMLHttpRequest (){
If (window. ActiveXObject ){
XmlHttp = new ActiveXObject ("microsoft. XMLHTTP ");
}
Else if (window. XMLHttpRequest ){
XmlHttp = new XMLHttpRequest ();
}
}
Function sendRequest (t ){
Var id = t. id
CreateXMLHttpRequest ();
Var url = "mouseover_check.php? Page = "+ t. id;
XmlHttp. onreadystatechange = callback;
XmlHttp. open ('get', url, true );
XmlHttp. send (null );
}
Function callback (){
If (xmlHttp. readyState = 4 ){
If (xmlHttp. status = 200 ){
Document. getElementById ("show"). innerHTML = xmlHttp. responseText;
}
}
}
</Script>
<Body>
<P>
<Input type = "text" value = "here" id = "1" onmouseover = "sendRequest (this)"/>
</P>
<P> <br/>
<Input type = "text" value = "haha" id = "2" onmouseover = "sendRequest (this)"/>
</Div>
</P>
<P> </p>
<Span id = "show"> </span>
</Body>
</Html>
Server code:
Mouseover_check.php
Copy codeThe Code is as follows:
<? Php
Header ("Content-type: text/html; charset = gb2312 ");
Header ("cache-control: no-cache, must-revalidate ");
$ Name = $ _ GET ['page'];
If ($ name = '1 '){
Echo & quot; 111 & quot ";
}
Else {
Echo & quot; 222 & quot ";
}
?>