showModalDialog使用

阅读更多

公共方法:

/*******************************************************************************

 * 打开模式窗口

 */

function openMoodaDialog(sdesc, surl, swidth, sheight) {

var iWidth = 750;

var iHeight = 500;

if (swidth && swidth > 0) {

iWidth = swidth;

}

if (sheight && sheight > 0) {

iHeight = sheight;

}

var left = (window.screen.availWidth - iWidth) / 2;

var top = (window.screen.availHeight - iHeight) / 2;

var features = "scrollbars=yes;location=no;toolbar=no;resizable=yes;help=no;status=no;center=yes;dialogTop="

+ top

+ ";dialogLeft="

+ left

+ ";dialogHeight="

+ iHeight

+ "px;dialogWidth=" + iWidth + "px;";

if(surl.indexOf("?")!=-1){

surl = surl+"&td="+new Date().getTime();

}else{

surl = surl+"?td="+new Date().getTime();

}

// 将window传给子窗口

var childwin = window.showModalDialog(surl, window, features);

return childwin;

}

 

 

调用方法:

function add(){

var surl="bp-bank-exrate!add.action";

var vReturnValue   = openMoodaDialog("",surl,750, 400);

if(vReturnValue == "close"){

window.opener=null;   

window.location.reload();//重新加载父窗口  

}

}

 

 

新增方法:

$(function($)

$("#formadd").attr("action","bp-merchant-fee-rule!save.action");

$("#formadd").submit();

window.returnValue="close";

 

 

});

你可能感兴趣的:(showModalDialog使用)