<!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>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<script type="text/javascript" src="xmlhttp.js"></script>
<!--引入出啊概念了XMLHttpRequest对象的js文件--><script type="text/javascript">
var xmlhttp;
var opp;
function go(){
// opp=op;
//e_obj=document.getElementById(value);
xmlhttp=createXMLHttpRequest();//调用创建XMLHttpRequest对象的方法
//alert(xmlhttp);
xmlhttp.onreadystatechange=callback;//设置回调函数
xmlhttp.open("post","index.jsp");//向服务器端发送请求 //请求servlet失败
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
xmlhttp.send(null);//设置发送参数
}
function addRow(align,n1,n2){
var tt=document.getElementById('userinfo');
var newRow=tt.insertRow();
for(var c=1;c<3;c++){
var newCell=newRow.insertCell();
newCell.align=align;
newCell.innerHTML=eval("n"+c);
}
}
function callback(){
//alert('callback');
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
var jsonObj=new Object();
// alert(xmlhttp.responseText);
jsonObj=xmlhttp.responseText;
alert(jsonObj);
for(var t=0;t<jsonObj.Userinfo.length;t++){
//addRow("center",jsonObj.Userinfo[t].name,jsonObj.Userinfo[t].pwd);
}
}
}
}
</script>
</head>
<body background="bg.gif" onload="go()">
</body>
</html>怎样让它显示表格?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<script type="text/javascript" src="xmlhttp.js"></script>
<!--引入出啊概念了XMLHttpRequest对象的js文件--><script type="text/javascript">
var xmlhttp;
var opp;
function go(){
// opp=op;
//e_obj=document.getElementById(value);
xmlhttp=createXMLHttpRequest();//调用创建XMLHttpRequest对象的方法
//alert(xmlhttp);
xmlhttp.onreadystatechange=callback;//设置回调函数
xmlhttp.open("post","index.jsp");//向服务器端发送请求 //请求servlet失败
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
xmlhttp.send(null);//设置发送参数
}
function addRow(align,n1,n2){
var tt=document.getElementById('userinfo');
var newRow=tt.insertRow();
for(var c=1;c<3;c++){
var newCell=newRow.insertCell();
newCell.align=align;
newCell.innerHTML=eval("n"+c);
}
}
function callback(){
//alert('callback');
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
var jsonObj=new Object();
// alert(xmlhttp.responseText);
jsonObj=xmlhttp.responseText;
alert(jsonObj);
for(var t=0;t<jsonObj.Userinfo.length;t++){
//addRow("center",jsonObj.Userinfo[t].name,jsonObj.Userinfo[t].pwd);
}
}
}
}
</script>
</head>
<body background="bg.gif" onload="go()">
</body>
</html>怎样让它显示表格?
解决方案 »
- 关于jquery的get方法
- ssl加密后页面有指向其他网站的地址Ie8下面出现提示
- js里设置页面属性和HTML的写法有什么区别
- div+mouseenter+mouseout模拟title如何添加延时???
- javascript如何发出一个向服务器的请求?一直等....
- 急:在线等待,我在一个网页的一个表格单元格中加入了一个<iframe src="1.htm" name=frameMain></iframe>,请问怎样在原来的网页()构架
- 如何把<Textarea>中的rows属性和对应CSS中的style.height对应起来?
- 两个text输入框,一个输入后,如何触发另一个自动显示出对应的值,如何实现?
- 各位高手!请问如何作出CSDN论坛隐藏显示左侧列表的功能?谢谢
- 同一个页面多个select 多个onChange 请问怎么写?
- 图片连续滚动不兼容火狐浏览器、、
- 无法实现页面跳转
http://topic.csdn.net/u/20070713/16/aae03828-bab1-47e9-b0dd-922618666a6b.html