关于不刷新页面提交数据,并返回的问题。 用iframe 弄一个1*1的框架, 选择下拉列表 的onchange事件, 连动到iframe就可以了. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 以下三个文件,存在同一个目录下,打开第三个文件,可以看到相关的效果:---------getDataFromServerDialog.htm-----------------<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>JK:支持民族工业,尽量少买X货</title></head><body ><h5 align=center valign=middle >正在查找资料</h5></body></html><script>windowArguments=window.dialogArguments;function returnFun(){windowArguments.value="dataFromServer";window.close();}setTimeout("returnFun()",100);</script>---------getDataFromServerDownload.htm-----------------dataFromServer---------getDataFromServer.htm-----------------<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>JK:支持民族工业,尽量少买X货</title></head><body>Code<input name=a0 onchange="getDataFromServer0()" ><input type=button value="getDataFromServer" onclick="getDataFromServer0()"><br>Name<input name=b0 disabled><br>window.showModelessDialog方式:尽管不是很友好,但它是非模态的,并且无安全限制<br><br>Code<input name=a1 onchange="getDataFromServer1()" ><input type=button value="getDataFromServer" onclick="getDataFromServer1()"><br>Name<input name=b1 disabled><br>window.showModalDialog方式:模态,无安全限制<br><br><IE:Download ID="oDownload" STYLE="behavior:url(#default#download)" />Code<input name=a2 onchange="getDataFromServer2()" ><input type=button value="getDataFromServer" onclick="getDataFromServer2()"><br>Name<input name=b2 disabled><br>oDownload.startDownload方式:非模态,无安全限制<br><br>Code<input name=a3 onchange="getDataFromServer3()" ><input type=button value="getDataFromServer" onclick="getDataFromServer3()"><br>Name<input name=b3 disabled><br>Microsoft.XMLHTTP方式:模态,代码与界面都挺友好,不过如果取数据页面反应很慢,则效果有所折扣。<br><br></body></html><script>function getDataFromServer0(){ document.all.b0.value=""; window.showModelessDialog("getDataFromServerDialog.htm",document.all.b0,"status:no;resizable:no;help:no;dialogHeight:30px;dialogWidth:200px;");}function getDataFromServer1(){ document.all.b1.value=""; window.showModalDialog("getDataFromServerDialog.htm",document.all.b1,"status:no;resizable:no;help:no;dialogHeight:30px;dialogWidth:200px;");}function getDataFromServer2(){ document.all.b2.value=""; oDownload.startDownload('getDataFromServerDownload.htm',setB2Value);}function setB2Value(v){ document.all.b2.value=v;}function getDataFromServer3(){ document.all.b3.value=""; var theXmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" ); theXmlHttp .open( "get", "getDataFromServerDownload.htm", false ); theXmlHttp .send(); document.all.b3.value=theXmlHttp.responseText;}</script> 我没有试过,但理论上可以,就是套一个Iframe,将表单提交到Iframe里面,由这个页进行刷新,然后再用javascript将值带回来,就实现此页不刷新而更新数据了,当然,这个Iframe页面可以设为宽高都是0,只是一个思路,没试过,有兴趣你可以试试 看看这个页,无刷新http://www.npggw.com/ftp/ytcm/main.asp JK_10000(JK) ( ) 的方法帮我把问题解决了,非常感谢,分数都给你了并请教我用了第三种方法,有什么局限性吗? oDownload.startDownload 很少见有人使用,JK也不大清楚它的局限性,如果你要用的话,最好自己去查一查资料作一些深入了解。Microsoft.XMLHTTP方式是最常用的方式,比较成熟,它的优缺点大家都很明白。 再次感谢了。oDownload.startDownload给我感觉速度很快,我自己去找找资料看看 javascript中的正则表达式的问题 关于easyui datagrid页码的问题 为什么如下脚本在IE下没问题,在发firefox5.0下面没反应呢? 为什么这个js代码在ie8.0下不能运行,应该怎么修正,谢谢了 js数组遍历输出问题~~ web不调用插件怎么实现直接打印 求类似sohu首页广告效果 求助:使用VML画线问题 来者有分!<iframe>与父页面的背景协调问题!请大家帮忙看看! js 中当Array作为一个dict时应该如何求其长度 如何限制梅花雨日历只能点击选中今天及向后,以前的日期不能选择 一个关于表格的问题(急中)
---------getDataFromServerDialog.htm-----------------
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JK:支持民族工业,尽量少买X货</title>
</head><body >
<h5 align=center valign=middle >正在查找资料</h5>
</body></html><script>
windowArguments=window.dialogArguments;function returnFun()
{
windowArguments.value="dataFromServer";
window.close();
}setTimeout("returnFun()",100);
</script>
---------getDataFromServerDownload.htm-----------------
dataFromServer
---------getDataFromServer.htm-----------------
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JK:支持民族工业,尽量少买X货</title></head><body>
Code<input name=a0 onchange="getDataFromServer0()" ><input type=button value="getDataFromServer" onclick="getDataFromServer0()"><br>
Name<input name=b0 disabled><br>
window.showModelessDialog方式:尽管不是很友好,但它是非模态的,并且无安全限制<br><br>Code<input name=a1 onchange="getDataFromServer1()" ><input type=button value="getDataFromServer" onclick="getDataFromServer1()"><br>
Name<input name=b1 disabled><br>
window.showModalDialog方式:模态,无安全限制<br><br>
<IE:Download ID="oDownload" STYLE="behavior:url(#default#download)" />
Code<input name=a2 onchange="getDataFromServer2()" ><input type=button value="getDataFromServer" onclick="getDataFromServer2()"><br>
Name<input name=b2 disabled><br>
oDownload.startDownload方式:非模态,无安全限制<br><br>Code<input name=a3 onchange="getDataFromServer3()" ><input type=button value="getDataFromServer" onclick="getDataFromServer3()"><br>
Name<input name=b3 disabled><br>
Microsoft.XMLHTTP方式:模态,代码与界面都挺友好,不过如果取数据页面反应很慢,则效果有所折扣。<br><br></body></html>
<script>
function getDataFromServer0()
{
document.all.b0.value="";
window.showModelessDialog("getDataFromServerDialog.htm",document.all.b0,"status:no;resizable:no;help:no;dialogHeight:30px;dialogWidth:200px;");
}function getDataFromServer1()
{
document.all.b1.value="";
window.showModalDialog("getDataFromServerDialog.htm",document.all.b1,"status:no;resizable:no;help:no;dialogHeight:30px;dialogWidth:200px;");
}
function getDataFromServer2()
{
document.all.b2.value="";
oDownload.startDownload('getDataFromServerDownload.htm',setB2Value);
}function setB2Value(v)
{
document.all.b2.value=v;
}function getDataFromServer3()
{
document.all.b3.value="";
var theXmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );
theXmlHttp .open( "get", "getDataFromServerDownload.htm", false );
theXmlHttp .send();
document.all.b3.value=theXmlHttp.responseText;
}
</script>
http://www.npggw.com/ftp/ytcm/main.asp
的方法帮我把问题解决了,非常感谢,分数都给你了
并请教我用了第三种方法,有什么局限性吗?
Microsoft.XMLHTTP方式是最常用的方式,比较成熟,它的优缺点大家都很明白。