求救阿,我想问一下模态窗口如何返回多个参数
模态窗口的返回信息RegisterStartupScript("key", "<script>window.returnValue='" + st + " ';window.opener=null;window.close(this);</script>")目前模态窗口的返回是st 一个字符串,但是我还有其他的如st1,st2 怎么回传
或者数组主窗口
imgbt1.Attributes.Add("onclick", "var st=window.showModalDialog('a.aspx',window,'dialogWidth:940px;DialogHeight=650px;status:no');document.all('t_sub_city1').value=st;return st;")我主窗口该如何得到呢,目前只是一个参数,
如果是数组我该怎么得到呢,谢谢了

解决方案 »

  1.   

    window.returnValue = new Array(1,2,3,4...);
      

  2.   

    var st = window.showModalDiallog(...if(st != null)
    {
       for(var i=0;i<st.length;i++
       {
        alert(st[i]);
       }
    }
      

  3.   

    c#实现方式:
    string str = "";
    string[] ckb = null;str = this.txtDir.Text;
    if (str != null)
       ckb = str.Split(new char[] { ',' });
    实现javascript的思路是一样的!
      

  4.   

    模式窗体中:
    string scr = string.Format(@"<script>
    var v = new Array('{0}', '{1}', '{2}', '{3}', '{4}')
    window.parent.returnValue=v;
    window.parent.close();
    </script>
    ",
                            code,
                            name,
                            model,
                            spec,
                            unitTitle);
    接收窗体中:
    string scr = string.Format(@"
    <script>
    var a = window.showModalDialog('{0}',null,'resizable:yes;dialogWidth:{1}px;dialogHeight:{2}px')
                    if (a != null)
    {{ 
    document.all.txtVIPCode.value = a[0];
                        document.all.txtVIPName.value = a[1];
    }}
    window.document.Form1.submit()
    </script>",
                    url,
                    AppInfo.GetInstance().SelVIPPage2_Width,
                    AppInfo.GetInstance().SelVIPPage2_Height
                    );
    根据你的应用情况改一下就可以了详细的使用我的知识库中有:
    http://60.218.11.205/myfotodemo/tools/knowledgebase.aspx在:信息类别\语言环境\aspDotNet\解决方案\页面\My doc  返回多个字段信息
      

  5.   

    我很感谢大家的无私帮助,对于一个新手来说,你们对我是很大的帮助,在这里谢谢你们了特别感谢yehzh()