<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script type="text/javascript">
onload = function () {
window.document.getElementById("Button1").onclick = function () {
var xhr = null
if (XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else {
xhr = new ActiveXObject("Microsoft.XMLHTTP");//兼容IE6,IE5
}
xhr.open("get", "Handler2.ashx?a=bbb",true);
xhr.send();
xhr.onreadystatechange = function () {//回调函数
if(xhr.readyState==4){
if (xhr.status == 200) {
alert(xhr.responseText);
}
}
};
}
};
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
</html>