如何让多个表单在新窗口中打开!

cjdxhc 2010-08-05 12:16:13
<!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" />
<title>测试</title>
<script type="text/javascript">
function cf(){
document.getElementById('frmA').submit();
document.getElementById('frmB').submit();
}
</script>
</head>

<body>
<form action="http://www.baidu.com" id="frmA" target="_blank">
</form>
<form action="http://www.google.com.hk" id="frmB" target="_blank">
</form>
<input type="button" onclick="javascript:cf()" value="提交" />
</body>
</html>


点击按钮后,在新窗口中打开百度和谷歌2个网站,在IE、Opera、FF下可以成功,但是在Chrome、safari下只能打开最后一个,即是谷歌,如何兼容呢?
...全文
109 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
weir_007 2012-07-17
  • 打赏
  • 举报
回复
而且得是小窗口。。。
孟子E章 2010-08-05
  • 打赏
  • 举报
回复
你可以这样
<!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">
function cf(){

window.open('',"A")

window.open('',"B")

document.getElementById('frmA').submit();
document.getElementById('frmB').submit();
}
</script>
</head>

<body>
<form action="http://www.baidu.com" id="frmA" target="A">
</form>
<form action="http://www.google.com.hk" id="frmB" target="B">
</form>
<input type="button" onclick="javascript:cf()" value="ccc" />
</body>
</html>
cjdxhc 2010-08-05
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 theforever 的回复:]
把每个FORM放在IFRAME中的单独页面里就可以了.
[/Quote]

那有多个form,需要建立多个页面
也要放到多个iframe里?
  • 打赏
  • 举报
回复
把每个FORM放在IFRAME中的单独页面里就可以了.
cjdxhc 2010-08-05
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 net_lover 的回复:]
你可以这样

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>
<met……
[/Quote]

IE下会自动阻止新窗口的打开,这个有没有什么好方法,其他浏览器都不会!

5,006

社区成员

发帖
与我相关
我的任务
社区描述
解读Web 标准、分析和讨论实际问题、推动网络标准化发展和跨浏览器开发进程,解决各种兼容性问题。
社区管理员
  • 跨浏览器开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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