<br /><script><br />//Ajax<br />var xmlHttp;<br /><br /> function createXMLHttpRequest() {<br /> if(window.XMLHttpRequest) {<br /> xmlHttp = new XMLHttpRequest();<br /> } else if (window.ActiveXObject) {<br /> xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");<br /> }<br /> }<br /><br /> function record(id){<br /> createXMLHttpRequest();<br />//指定目标地址及参数<br /> url = "action.php?id="+id+"&ran="+Math.random();<br /> method = "GET";<br /> xmlHttp.open(method,url,true);<br /> xmlHttp.onreadystatechange = show;<br /> xmlHttp.send(null);<br /> }<br /><br /> function show(){<br /> if (xmlHttp.readyState == 4){<br /> if (xmlHttp.status == 200){<br />//回调函数,返回的后端结果<br /> var text = xmlHttp.responseText;<br /> document.getElementById("s2").innerHTML = text;<br /> }else {<br /> alert("response error code:"+xmlHttp.status);<br /> }<br /> }<br /> }<br /></script><br />
能运行就行
Statement:
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