模式窗体提交时不打开新的页面

本文介绍如何在HTML页面中使用window.showModalDialog函数创建模态对话框,并详细解释了如何在对话框中加入base标签来避免页面重新加载问题。同时,文章还演示了如何通过URL参数在不同页面间传递数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

 

在<head>中加入:

 

<base target="_self" />
<meta http-equiv="pragma" content="no-cache" />

 

即可

 

 

1.window.showModalDialog("DialogPage.aspx","newwin","dialogHeight:   200px;   dialogWidth:   150px;   dialogTop:   458px;   dialogLeft:   166px;   edge:   Raised;   center:   Yes;   help:   Yes;   resizable:   Yes;   status:   Yes;");  
   
  2.window.close();  
   
  3.传值  
  ParentPage.aspx:  
  window.showModalDialog("DialogPage.aspx?para1=aaa&para2=bbb");  
   
  DialogPage.aspx:  
  string   str1=Request.QueryString["para1"].toString();  
  string   str2=Request.QueryString["para2"].toString();  
   
  返回值  
  DialogPage.aspx:  
  window.returnValue="aaa";  
   
  ParentPage.aspx:  
  var   str=window.showModalDialog("DialogPage.aspx");  
   
  4.  
  aspx页面在showmodeldialog情况下为什么一提交就重新打开一个页面?  
  showmodaldialog打开的页面中在<head></head>之间加入一行:<base   target="_self">   
   

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值