<script type="text/javascript">
var http_request = false;
function a()
{
var haha=document.f.t1.value;
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
//http_request.onreadystatechange = processRequest;
// 确定发送请求的方式和URL以及是否同步执行下段代码
http_request.open("GET",'/xmlhttptest/hehe.jsp?xu='+haha,false); //TRUE是同步 也就是当服务器返回信息后才继续下面的代码
http_request.send(null);
b();
}
function b() {
if (http_request.readyState == 4) { // 判断对象状态0 = 未初始化
//1 = 读取中,2 = 已读取,3 = 交互中,4 = 完成
if (http_request.status == 200) { // 信息已经成功返回,开始处理信息404 = "文件未找到" 、200 ="成功"
alert(http_request.responseText);//接获服务器端返回的值
}
}
}
</script>
</head>
<body>
<form name="f">
<input type="button" value="提交" onclick="a();">
<input type="button" value="获得" onclick="b();">
<input type="text" name="t1">
</form>
</body>
--------------------------------------
<%
String str = request.getParameter("xu");
System.out.println(str);
if(str.equals("java"))
{
out.println("thank you");
}
哪位大虾帮找一下错误
else
{
out.println("yout");
}
%>
还是不好用--------------------
sorry
好像是我myeclipse不好用
谢了各位大虾