submit()后能否不换页啊?

IPOz 2003-10-09 02:28:36
<form action="/test-web/monitorservlet?do=alarm" method="post" name="fm">
...
</form>

POST后因服务器不返回任何东东,所以IE显示空白页:(

有什么办法让IE不换页啊?要真真地不换页哦!


谢谢!
...全文
111 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
IPOz 2003-10-10
  • 打赏
  • 举报
回复
谢谢!
scycgjr 2003-10-10
  • 打赏
  • 举报
回复
sorry,更正如下:
------------------------------------------------------------------------------
<script>
function submitdata()
{
var obj=window.frames("DFrm").document;
obj.all("bh").value=document.all("bh").value;
obj.all("SFrm").submit();

}
-----------------------------------------------------------------------------
</script>
xlray 2003-10-09
  • 打赏
  • 举报
回复
form的本质是请求server端运行某特定程序,所以要么重装载页面,要么就是表单发送的target设定成非本页(比如指向一个不可见的iframe)

<html>
<head></head>
<body>
<form target="actfrm" action="b.php">
<input type="text" name="msg">
</form>
<iframe marginheight=0 marginwidth=0 frameborder=0 width=0 height=0 scrolling=no src="about:blank" name="actfrm">
</body></html>
IPOz 2003-10-09
  • 打赏
  • 举报
回复
iframe应该可以,但你的代码运行有错,说找不到all !
scycgjr 2003-10-09
  • 打赏
  • 举报
回复
用iframe试试
test.htm
--------------------------------------------------------------------------------
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<script>
function submitdata()
{
var obj=window.frames("DFrm").document;
obj.all("bh").value=tzid;
obj.all("DFrm").submit();

}
</script>
</head>

<body>
<p><input type="text" name="bh" id="bh" size="20"><input type="submit" value="提交" name="B1" onclick="submitdata()"></p>
<iframe name="DFrm" id="DFrm" src="test.asp" width=0 height=0></iframe>

</body>

</html>
---------------------------------------------------------------------------------
test.asp
---------------------------------------------------------------------------------
<%
数据处理
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<form method="POST" action="" name="DFrm" id="DFrm">
<input type="text" name="bh" id="bh" size="13" class="input">
<input type="hidden" name="result" value=100>
<input type="button" onclick="DFrm.submit();">
</form>

</body>

</html>
IPOz 2003-10-09
  • 打赏
  • 举报
回复
谢谢回答,但各位的方法都不能阻止IE换页,只不过是IE换过后,再用代码换回来!
我想只能用XmlHttp直接POST了!

xmlHttp.open("POST", "xxxxxxx", false);

......
zhfkiller 2003-10-09
  • 打赏
  • 举报
回复
重定向到本页
zhaoweiwei 2003-10-09
  • 打赏
  • 举报
回复
onsubmit="this.location.href=本页"
rongwenfeng 2003-10-09
  • 打赏
  • 举报
回复
如果是frame,target="_parent"
rongwenfeng 2003-10-09
  • 打赏
  • 举报
回复
target="_self"
fqingchu 2003-10-09
  • 打赏
  • 举报
回复
<script language=java script>
history.go(-1)
</script>
harryyang 2003-10-09
  • 打赏
  • 举报
回复
那就是重新刷新本頁面了...直接reload就可以了!!!

如果不放心,就像樓上一樣,action參數設置成本頁面路徑就可以了
孟子E章 2003-10-09
  • 打赏
  • 举报
回复
再重定向到本页啊
iinohk 2003-10-09
  • 打赏
  • 举报
回复
把action定為本身的頁面

a.asp:
<%
'asp code
%>
<form action="a.asp" method="post" name="fm">
...
</form>
你是不是想這樣?

87,987

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧