<script>
function fy(a){
var div= document.getElementById("div");
var table=document.createElement("table");
var xhr=null;
if(window.ActiveXObject){
//alert("IE浏览器");
//创建IE下的XMLHttpRequest对象
xhr=new ActiveXObject("Microsoft.XMLHTTP");
}
else{
//alert("FireFox"); xhr=new XMLHttpRequest();//在ff中的创建方式
} //alert(xhr.readyState);
//向服务器发送数据
xhr.open("get","http://localhost:8080/ajaxpage/fenyes?dqy="+a+"&rad="+Math.random(),true);//告诉xhthttpRequest请求方式是什么 请求的地址什么 同步还是异步
xhr.onreadystatechange=function(){
var obj=xhr.responseText
var s=eval("("+obj+")");
var stList=s["userList"];
var dqy=s["dqy"];//我就想在当前页面获得这里的dqy
alert(dqy);
var fn=div.firstChild
if(fn!=null){
div.removeChild(fn);
}
for(var i=0;i<stList.length;i++){
var tr=table.insertRow();//有行 了
for(var j in stList[i]){
var td=tr.insertCell();
td.innerHTML=stList[i][j];
}
}
div.appendChild(table);
} xhr.send();//send()方法是向服务器发送数据---------------------------------------------------------------------------
<body>
<form action="">
<input type="text">
</form>
<div style="margin:8px" id="div">
</div>
<a href="javascript:fy(1)" >[首页]</a>
<a href="javascript:fy(如何在这里接到dqy呢!)">[上一页]</a>
<a href="">[下一页]</a>
<a href="">[尾页]</a> <s:debug></s:debug>
</body>
}
</script>
function fy(a){
var div= document.getElementById("div");
var table=document.createElement("table");
var xhr=null;
if(window.ActiveXObject){
//alert("IE浏览器");
//创建IE下的XMLHttpRequest对象
xhr=new ActiveXObject("Microsoft.XMLHTTP");
}
else{
//alert("FireFox"); xhr=new XMLHttpRequest();//在ff中的创建方式
} //alert(xhr.readyState);
//向服务器发送数据
xhr.open("get","http://localhost:8080/ajaxpage/fenyes?dqy="+a+"&rad="+Math.random(),true);//告诉xhthttpRequest请求方式是什么 请求的地址什么 同步还是异步
xhr.onreadystatechange=function(){
var obj=xhr.responseText
var s=eval("("+obj+")");
var stList=s["userList"];
var dqy=s["dqy"];//我就想在当前页面获得这里的dqy
alert(dqy);
var fn=div.firstChild
if(fn!=null){
div.removeChild(fn);
}
for(var i=0;i<stList.length;i++){
var tr=table.insertRow();//有行 了
for(var j in stList[i]){
var td=tr.insertCell();
td.innerHTML=stList[i][j];
}
}
div.appendChild(table);
} xhr.send();//send()方法是向服务器发送数据---------------------------------------------------------------------------
<body>
<form action="">
<input type="text">
</form>
<div style="margin:8px" id="div">
</div>
<a href="javascript:fy(1)" >[首页]</a>
<a href="javascript:fy(如何在这里接到dqy呢!)">[上一页]</a>
<a href="">[下一页]</a>
<a href="">[尾页]</a> <s:debug></s:debug>
</body>
}
</script>
解决方案 »
- 最近在做ssl项目,是不是生成一次客户端证书,服务端的tomcat.keystore就要变一次
- 哪位高手帮忙解释下callback机制
- 求JAVA中的令牌例子
- Spring 入门时遇到的问题
- 急:spring中jdbc的批量处理问题
- 谁有"j2ee核心模式"的代码,给我一份好吗,谢谢先!
- 在哪里有tomcat下载。在http://jakarta.apache.org/tomcat/index.html找不到。顺便说说这个网站好烂。
- 请帮我看一下这段代码为什么连不上数据库。。。(I'm 菜鸟)
- 各位大哥,小弟没钱了,可还有很多问题呀。。。拉兄弟一把呀。。。
- 使用ssm框架实现一个表单同时将数据存入两张表(存一个问题,多个答案)
- 坑爹啊!myeclipse点号卡机问题!
- AJAX分页中如何获得JS里的变量值
dqy is function a private field when you invection the fucntion you can't get the function's field