window.returnValue使用方法

var sUrl = "impexcelconfig.htm?fileName="+encodeURIComponent(fileName);

 var ret =  EGOVA.page.WindowUtils.modalDialog(sUrl, window, {width:"650px", height:"545px"});

var param="startLine="+startLine+"&endLine="+
        endLine+"&sheetName="+encodeURIComponent(tempSheetName)+
        "&relative="+relative;
window.returnValue = param;
window.close();

1、parent.html

//father.html   
<HTML>  
<HEAD>  
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">  
<TITLE></TITLE>  
<script language="javascript">  
  
function showmodal(){   
var ret = window.showModalDialog("child.htm",null,"dialogWidth:350px;dialogHeight:350px;help:no;status:no");   
    if (ret){alert('子窗口返回真!');   
    }else{   
         alert('子窗口返回假!');   
   }   
}   
</script>  
</HEAD>  
  
<BODY>  
<INPUT id=button1 type=button value=Button name=button1 onclick="showmodal();">  
</BODY>  
</HTML>
2、child.html

//child.html   
<HTML>  
<HEAD>  
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">  
<TITLE></TITLE>  
<script language="javascript">  
function trans(tag){   
   if (tag==0){   
       window.returnValue=false;   
   } else{   
       window.returnValue =true;   
  }   
   window.close();   
}   
</script>  
</HEAD>  
<BODY>  
  
<INPUT id=button1 type=button value="返回真" name=button1 onclick="trans(1)">  
<INPUT id=button2 type=button value="返回假" name=button2 onclick="trans(0)">  
  
</BODY>  
</HTML>
returnValue除了可以是布尔值,整型值等以外还可以是个js数组,用来传递大量数据。

你可能感兴趣的:(window.returnValue使用方法)