showModalDialog窗口中提交表单弹出新窗口解决

在showModalDialog窗口中,我按提交后又出来一个新窗口,怎样才能不这样啊?急啊!

方法1:   
  在这个页面的外面套一个iframe   
  方法2:  
  在这个页面的head里加上这句:  
  <base   target="_self"/>

方法1:例子(网上收集未验证)

window.showModalDialog的用法,form表单提交不弹出新窗口
用frame把form表单包含起来index.html 
<html>
<head>
<script>
function showDialog(url,argv,dialogHeight,dialogWidth){
              var sFeatures="dialogHeight:"+dialogHeight+"px;dialogWidth:"+dialogWidth+"px;status:0;"
              return window.showModalDialog(url,argv,sFeatures);
}
function doShow()
{  
       var timestamp = Date.parse(new Date());
       showDialog("frame.html?timestamp="+timestamp,null,500,650);
}
</script>
</head><body>
<form>
<input type ="button" οnclick="doShow();return fasle" value="Test"/>
</form> 
</body>
</html> frame.html 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>   
       <script>
              if(window.location.search) alert(window.location.search)
       </script>   
<frameset cols="0,*" frameborder="NO" border="0" framespacing="0">
  <frame src="about:blank">
  <frame src="form.html">
</frameset>
<noframes><body>
</body></noframes>
</html> from.html
Javascript Timestamp
Javascript拿到当前时间戳 
<html>
       <head>
              <title>Javascript Timestamp Javascript拿到当前时间戳</title>
              <script>
                     function timestamp(){
                            var timestamp = Date.parse(new Date());
                            return timestamp;
                     }
              </script>
       </head>
       <body>
              <form method="POST" target="_self">
       <!--
       <input type="button" οnclick="alert(timestamp())" value="JavaScript-Timestamp-Test-Button"/>
       --> 
       <input type="input" name=""/>
       <input type="submit" value="Test" /> 
              </form>          
<script>
 if(window.location.search) alert(window.location.search)
 </script>
       </body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值