showModalDialog通过window.returnValue向父页面传值

父页面:

function showValue(){

	var values= openwindow();
	
	if(values != null){
	
		//alert(values.cardNo);
		
	}

function openwindow()
 {
 	  var result;
	  var url = '../../main_hbyf/so/baSpecObjInfoAction.do?method=openBaSpecObjInfo&flag=1';                                 //转向网页的地址;
	  var name = new Date().getTime();                           //网页名称,可为空;
	  var iWidth ='1000px';                          //弹出窗口的宽度;
	  var iHeight = '1024px';                        //弹出窗口的高度;
	  var iTop = (window.screen.availHeight-30-iHeight)/2;       //获得窗口的垂直位置;
	  var iLeft = (window.screen.availWidth-10-iWidth)/2;           //获得窗口的水平位置;	 
	  result = window.showModalDialog(url,name,"dialogWidth=800px;dialogHeight=500px;center:yes");
 	  //alert(returnValue.cardNo);
 	  return result;
 }

 model页面:

function returnVal(id){
	var obj;
	$.ajax({
	          type:'post',
	          url:'../../main_hbyf/so/baSpecObjInfoAction.do?method=getBaSpecObjInfoById',
	          data:'id=' + id,
	          cache:false,
	          success:function(data){
	               //obj = eval( "(" + data + ")" );	               
	               //alert(data);	              
	               window.returnValue =data;
	               window.close();
	          }
	   });
	   
}

 

你可能感兴趣的:(showModalDialog)