首页 新闻 会员 周边

window.returnValue问题

0
悬赏园豆:5 [已关闭问题]

sel_date.aspx : 

    <script language="javascript">

        function GetDate()
        {
            var reVal=window.showModalDialog("day.aspx", '',
                "status:no;center:yes;scroll:no;resizable:no;help:no;dialogWidth:340px;dialogHeight:250px");
            if(reVal!="")
            {
            document.formAct.txt_receive_date.value=reVal;  //返回所选的日期
            };
        };
    </script>

------------------------------------------------

day.aspx

    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        string sel_date = Calendar1.SelectedDate.ToShortDateString();
        Response.Write("<script>window.returnValue=" + sel_date + ";</script>");
        Response.Write("<script>window.close();</script>");
    }

 

问题是返回的时候:总是出现选择2008-09-01确是1998等错误的信息

张志聪的主页 张志聪 | 初学一级 | 园豆:195
提问于:2008-09-18 14:12
< >
分享
其他回答(3)
0

你试着 alert(reVal) 看看结果是什么,怀疑返回的window.returnValue有问题

另外,IE7下面这个样子使用window.showModalDialog有问题,FF也不支持

丁学 | 园豆:18730 (专家六级) | 2008-09-18 15:27
0

你直接Response.Write("<script>window.returnValue=" + sel_date + ";window.close();</script>");
我用过的,没问题。

码尔代夫iimax | 园豆:3138 (老鸟四级) | 2008-09-19 09:10
0

用parent.document.formAct.txt_receive_date.value =" + sel_date + ";

Jeremy Liu | 园豆:705 (小虾三级) | 2008-09-19 22:59
0

也可以在子窗口操作时,赋值给父窗口

zjy | 园豆:3194 (老鸟四级) | 2008-09-24 17:12
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册