提交表单时要打开另外一个url应该怎么做?

yangsongxs 2008-08-26 11:58:17
各位大哥,我要实现一个这样的功能:

在提交一个form表单时,除了执行原来表单action需要执行的动作外,还要另外执行一个这样的动作:
提交表单时打开另外一个url如 "http://localhost:8080/adduser.jsp?type=add&username=123456&password=123456"

这个要怎么做呢?
...全文
173 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhihuixiaole 2008-09-19
  • 打赏
  • 举报
回复
1楼的就行
szoe5203 2008-09-19
  • 打赏
  • 举报
回复
用window.open()方法被浏览器拦截的概率比用<iframe>要大
推荐用<iframe>
tang52000 2008-09-19
  • 打赏
  • 举报
回复
<!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=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function init()
{
document.forms[0].submit();

}


</script>


</head>


<body onload="init();">
<form action="goto.asp" name="goto" target="submitFrame">
<input type="text" name="userName" value="1" />
</form>

<iframe name="submitFrame" width="0" height="0"></iframe>
</body>
</html>
zzxap 2008-09-03
  • 打赏
  • 举报
回复
1楼的就可以
zhihuixiaole 2008-09-03
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zl_c 的回复:]
我这里用的是window.open(),当然你可以按你要求来处理,如果不要弹出来,用隐藏的 <iframe>也行.
HTML code<!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=gb2312" />
<title>无标题文档</title>
</head>
<script lan…
[/Quote]
shi a
jackyBody 2008-09-03
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 yangsongxs 的回复:]
实在不好意思,请问用隐藏的 <iframe>怎么弄?
[/Quote]

<iframe height="0" width="0" src="" ></iframe> 修改src 路径即可~~
ccaakkee 2008-09-02
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zl_c 的回复:]
我这里用的是window.open(),当然你可以按你要求来处理,如果不要弹出来,用隐藏的 <iframe>也行.
HTML code<!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=gb2312" />
<title>无标题文档</title>
</head>
<script lan…
[/Quote]
yangsongxs 2008-09-01
  • 打赏
  • 举报
回复
要隐含打开的url怎么办?

谁能告诉我?
yangsongxs 2008-09-01
  • 打赏
  • 举报
回复
楼上的,你有本事你就把答案贴出来看看。
qiandongbo 2008-09-01
  • 打赏
  • 举报
回复
LZ去看看HTML代码比较合适~忽忽
yangsongxs 2008-09-01
  • 打赏
  • 举报
回复
实在不好意思,请问用隐藏的 <iframe>怎么弄?
zl_c 2008-08-27
  • 打赏
  • 举报
回复
我这里用的是window.open(),当然你可以按你要求来处理,如果不要弹出来,用隐藏的<iframe>也行.
<!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=gb2312" />
<title>无标题文档</title>
</head>
<script language="javascript">
function s(obj)
{
window.open("http://localhost:8080/adduser.jsp?type=add&username=123456&password=123456");//这里由你处理
return true;
}
</script>
<body>
<form action="" method="get" onsubmit="return s(this)">
<input name="aaa" value="xxx" />
<input type="submit" value="submit" />
</form>
</body>
</html>
justicesun 2008-08-27
  • 打赏
  • 举报
回复
两种方法...提交的时候用js

提交后打开新页面时用js
redcn2004 2008-08-27
  • 打赏
  • 举报
回复
1楼正解,我就不说了
小雨转晴 2008-08-27
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zl_c 的回复:]
我这里用的是window.open(),当然你可以按你要求来处理,如果不要弹出来,用隐藏的 <iframe>也行.HTML code<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html; charset=gb2312"/><title>无标题文档</title></head><scriptlanguage="javascript">…
[/Quote]

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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