showdialog模态窗口中的POST方法

showdialog 在IE8中的post方法是打开一个新窗口,与火狐不同。所以如果在模态窗口里提交给后台的一些操作, 会造成不能控制关闭窗口的功能。解决办法是在<head></head>里加入<base target="_self" />.这样IE8里就好用了。

见如下代码:

ssa_list_content.cfm 写道
<script type="text/javascript" language="javascript">
function respond(e){
while(e.tagName != "TR")
{
e = e.parentNode;
}
var str = $(e).find("#lblACTVTYID").text();
var requsetIDStr = $(e).find("#lblRequsetID").text();
var result=window.showModalDialog('ssa_respond.cfm?ACTVTY_ID=' + str+'&REQT_ID='+requsetIDStr,'_blank','dialogWidth:500px;dialogHeight:500px;center:no;status:no');
if (result != null)
{
alert(result);
document.getElementById("formPostBackHandler").submit();
}

}
</script>
 
ssa_repond.cfm 写道
<head>
<base target="_self" />
</head>
 
ssa_gateway.cfc 写道
<script language="javascript">
window.returnValue = "Thank you for accepting the terms and conditions of the Single Service Agreement. You may now commence the Services in accordance with the terms and conditions of the Single Service Agreement.";
window.close();
</script>

 后台返回值给前台,result

window.returnValue 返回值

 

你可能感兴趣的:(JavaScript)