日期:2014-05-16  浏览次数:20300 次

js弹出模式对话框,判断并取返回值
父窗口打开模式窗口
var url="";
	var width=900;
	var height=800;
    var top=(window.screen.height-height)/2;
    var left=(window.screen.width-width)/2;//居中
var diaPraram = "dialogWidth:"+width+"px;dialogHeight:"+height+"px;dialogTop:"+top+"px;dialogLeft:"+left+"px";diaPraram += "status:yes;scroll:yes;help:no;resizable:no;"	
	ReturnValue = window.showModalDialog(url,window,diaPraram);
	if(typeof(ReturnValue)!="undefined"){   //当返回值不是未定义的时候取返回值,防止关闭窗口未返回值的时候报错
  var id=ReturnValue[0];
var name=ReturnValue[1];
}

模式窗口返回array:
var array = new Array(id,name);
	window.returnValue  =array; 
	window.close();