举个例子:<script>
var msg=showModalDialog('1.aspx', '','dialogWidth:360px;dialogheight:120px;status:no;help:no');
if ((msg)&&(msg.length!=0)){alert("传回来的值: " + msg);}
</script>在1.aspx里:
<body onbeforeunload="window.returnValue = 'abcdefg'">

解决方案 »

  1.   

    中间那个参数是否写父窗口的控件
    ('1.aspx',document.Form1.all.tbox1.value,'dialogWidth:360px;dialogheight:120px;status:no;help:no');
    然后在1.aspx里:
    window.returnValue = window.document.all.tboxqty.value;
    window.close();但是我的父窗口的控件没有接收到值,而且子窗口也关闭不了,这是为什么?
      

  2.   

    test.html
    <HTML><BODY>
    <input type="text" id="txt" size=20>
    <script>
    x = showModalDialog("testnew.html");
    txt.value = x;
    </script>
    </BODY></HTML>testnew.html<HTML><BODY>
    <input type="text" name="dlgtxt">
    <button onclick="doSomething()">do somthing</button>
    <script>
    function doSomething(){
      returnValue = dlgtxt.value;
      close();
    }
    </script>
    </BODY></HTML>
      

  3.   

    你的代码我用不上呀,因为在ASP.NET里面不能这样写呀,我只能用btzxsel.Attributes("onClick") = "javascript:return OpenDialog();"来执行脚本,但是每次执行都新开了一个窗口,不知道怎么回事
      

  4.   

    在主页面里:
    <script language=javascript>
    var msg=showModalDialog('1.aspx', '','dialogWidth:360px;dialogheight:120px;status:no;help:no');
    if ((msg)&&(msg.length!=0)){alert("传回来的值: " + msg);}
    </script>在1.aspx里:
    <body onbeforeunload="window.returnValue =document.all.tboxqty.value">
    <input type=text name=tboxqty>
    <input type=button value=close onclick="window.close()">
      

  5.   

    <INPUT TYPE="button" VALUE="创建模态对话框" onclick="fnOpenModal()"> <br><br> <INPUT TYPE="button" VALUE="创建非模态对话框" onclick="fnOpenModeless()">
     <script language="javascript"> 
    <!-- var a = new Array; a[0]="first"; a[1]="second"; a[2]="third"; 
    function fnOpenModal()
    { window.showModalDialog("callee.htm",a) } 
    function fnOpenModeless()
    { window.showModelessDialog("callee.htm",a) } 
    // --> </script>  然后在callee.htm页面中输入以下代码: 
    <SCRIPT LANGUAGE="JavaScript"> 
    <!-- a = dialogArguments; alert(a); a[0] = "fourth"; // --> 
    </SCRIPT>  
      

  6.   

    http://www.csdn.net/Develop/read_article.asp?id=15113