<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>XmlHttp测试</title>
<script type="text/javascript">
function testxml()
{
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.open('POST','xmlhttp.aspx?name='+document.getElementById('Text1').value,false);
xmlhttp.send();
alert(xmlhttp.responseText);
}
</script>
</head>
<body>
<input id="Text1" maxlength="20" type="text" />
<input id="Button1" type="button" value="button" onclick="testxml()"/>
</body>
</html>
xmlhttp.aspx没有内容<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>XmlHttp测试</title>
<script type="text/javascript">
function testxml()
{
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.open('POST','xmlhttp.aspx?name='+document.getElementById('Text1').value,false);
xmlhttp.send();
alert(xmlhttp.responseText);
}
</script>
</head>
<body>
<input id="Text1" maxlength="20" type="text" />
<input id="Button1" type="button" value="button" onclick="testxml()"/>
</body>
</html>
xmlhttp.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class xmlhttp : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["name"] != null)
{
Response.Clear();
Response.Write("您好:"+Request.QueryString["name"].ToString());
Response.Flush();
Response.End();
}
}
}
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class xmlhttp : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["name"] != null)
{
Response.Clear();
Response.Write("您好:"+Request.QueryString["name"].ToString());
Response.Flush();
Response.End();
}
}
}