ajax基础运行不出来? - Web 开发 / Ajax
index.html:
HTML code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Using</title>
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest() {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("post", "in.html", true);
xmlHttp.send(null);
}
function handleStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
document.getElementById("results").innerHTML = xmlHttp.responseText;
}
}
}
</script>
</head>
<body>
<input type="button" value="Search" onclick="startRequest();"/>
<div id="results"></div>
</body>
</html>
in.html:
HTML code
Cod
相关问答:
<script language="javascript">
var XMLHttpReq;
var cont=true;
//创建XMLHttpRequest对象
function createXMLHttpRequest ......
我在一个html中写如下代码:
JScript code:
<html>
<head>
<script type="text/javascript" charset="utf-8"
src="script/jquery-1.3.2.min ......
因为网站都是生成静态的内容。有些东西没办法实时更新。我就做成了AJAX列表的形式了。
现在的问题来了,看下面的网址:
http://www.net1573.com/article/art_38.html
页面有广告加载,阅读次数,还有文章评论。这 ......