天天看點

一些和ajax的資料

<p>澶撮?ㄥ???借?杩??峰??

header("Content-Type: text/html; charset=gb2312");

header("Cache-Control: no-store, no-cache,must-revalidate");

<html>

?<head>

?<META HTTP-EQUIV="pragma" CONTENT="no-cache">

??<script>

var req;

function Initialize()

{

?try

?{

??req=new ActiveXObject("Msxml2.XMLHTTP");

?}

?catch(e)

?{

??try

??{

???req=new ActiveXObject("Microsoft.XMLHTTP");

??}

??catch(oc)

??{

???req=null;

??}

?}

?if(!req&&typeof XMLHttpRequest!="undefined")

?{

??req=new XMLHttpRequest();

?}

?

}

function SendQuery(key)

{

?Initialize();

?//key=Math.random();

?var url="http://staff.now.nxt.cn/vhost/monitor.php?k="+key;

?

?if(req!=null)

?{

??req.onreadystatechange = Process;

??req.open("GET", url, true);

??????? req.send(null);

???????

?}

?

}

function Process()

{

?if (req.readyState == 4)

??????? {

??????? // only if "OK"

???if (req.status == 200)

???{

????if(req.responseText=="")

?????HideDiv("autocomplete");

????else

????{

?????ShowDiv("autocomplete");

?????document.getElementById("autocomplete").innerHTML =req.responseText;

????}

???}

???else

???{

????document.getElementById("autocomplete").innerHTML="There was a problem retrieving data:<br>"+req.statusText;

???}

??}

}

function ShowDiv(divid)

{

?? if (document.layers) document.layers[divid].visibility="show";

?? else document.getElementById(divid).style.visibility="visible";

}

function HideDiv(divid)

{

?? if (document.layers) document.layers[divid].visibility="hide";

?? else document.getElementById(divid).style.visibility="hidden";

}

function BodyLoad()

{

?//HideDiv("autocomplete");

?//document.form1.keyword.focus();

?//setTimeout("SendQuery('test')",5000);

?setInterval("SendQuery('test')",5000);

?

}

</script>

?<style type="text/css">

??<!--

??.box { border: 1px solid #000000; }

??.heading {

???font-family: Georgia, "Times New Roman", Times, serif;

???font-weight: bold;

???font-size: 24px;

??}

??.style1 {color: #0033FF}

??.style2 {color: #CC0066}

??.style3 {color: #CC0000}

??.style4 {color: #33CCCC}

??.style6 {color: #669900}

??.style7 {color: #FF0066}

??.style8 {color: #FF6600}

??-->

?</style>

?<title>???″?ㄧ???ч〉??lt;/title></head>

?<body 慰nl慰ad="BodyLoad();">

??<form name="form1">

??<center>

???<input name="keyword" onKeyUp="SendQuery(this.value)" style="WIDTH:700px" autocomplete="off" style="display:none">

???<div align="left" class="box" id="autocomplete" style="WIDTH:700px;BACKGROUND-COLOR:#ccccff">璇誨???版??涓?...</div>

??</center>

??</form>

???? <p align="center">&nbsp;</p>

?</body>

</html>

繼續閱讀