我编写了个JSP页面A,在其中调用了window.showModalDialog,转到第二个JSP页面B,然后在B中通过TEXT控件接收用户的输入信息,然后把信息回传到父页面A,再刷新一次父页面,但是父页面老是得不到B页面传来的值,一直都是NULL,不清楚是怎么回事
A页面的script代码如下:function addFolder(){
    var newFolderName = window.showModalDialog("B.jsp",window,"status:no;scroll:no;dialogWidth:260px;dialogHeight:100px");
    if(newFolderName!=null){
    document.forms[0].theNewFolderName.value = newFolderName;    
                            // theNewFolderName是form中的一个TEXT文本输入框
    alert(newFolderName);
    document.forms[0].submit();
}
if(newFolderName==null){
alert("NULL");    //老是执行这一句,说明得到的一直为null值
}

[/code]
B页面的script代码如下:function returnValue(){
window.returnValue = document.form1.folderName.value;      
alert(document.newFolder.folderName.value);
window.close();
}folderName是form1中的TEXT文本输入框     window.returnValue这个是我在网是找的,看他们用的都没问题,怎么就我用了出问题,老是返回空值
麻烦大家知道的告诉我下,谢谢了 

解决方案 »

  1.   

    returnValue()这个名称改一下
    看不出有什么问题
      

  2.   

    我搞定了父窗口
    function selectPerson(){
    var myReturnValue="";
    myReturnValue=newShowModalDialog("../system/user_manage_index2.jsp");
    document.theForm.GRANTUSER.value=myReturnValue;
    }
    子窗口
    function select(thisForm)
    {
     var employeesList = document.getElementsByName("LOGIN_ID");
    var n=0;
    var grantuser="";
    for(var i=0;i<employeesList.length;i++){
    if(employeesList[i].checked == true){
    grantuser=employeesList[i].value;
    n++ ;
    }
    }
     if(n>1){
     alert("只能选择一个人");
     return;
     }
     if(n==0){
     alert("请选择用户");
     return;
     }
     window.parent.returnValue=grantuser;
     window.close();
     return true;
    }很简单的
      

  3.   

    最好采用这种方式 得到控件的值
    document.getElementById("tt").value;、