2007-7-9 17:47
php店小二
不刷新页面提交页面的两种方法
1、ajax
2、xmlHTTP
[code]<html>
<head>
<title>XMLHTTP</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<div id="divDisplay">The response will be put in here</div>
<input type="button" onclick="sendData();" value="Send it!">
<script>
function sendData(){
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("POST", "xml.jsp", false);
xmlhttp.Send("<id>123</id>");
divDisplay.innerHTML=xmlhttp.responseText;
}
</script>
</body>
</html>
[/code]