#2
青春无限2012-10-31 10:19
|
只有本站会员才能查看附件,请 登录
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www. >
<head>
<title></title>
<script type="text/javascript">
function onclick() {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
}
else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if (!xmlhttp) {
alert("aaa");
return;
}
xmlhttp.open("POST", "Handler1.ashx?ts" + new Date(), false);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
document.getElementById("text1").value = xmlhttp.responseText;
}
else {
alert("ajax出错");
}
}
}
xmlhttp.send();
}
</script>
</head>
<body>
<input type=text id="text1" />
<input id=bt1 type=button onclick="onclick()" value="buttom" />
</body>
</html>