異なるブラウザExt.Window親フォームでサブフォーム情報値を取得

2819 ワード

javascript :
    <script type="text/javascript">
        var i = 0, mygroup;
        function newWin() {
            //alert('ok');
            var win = new Ext.Window({
                id: "MyProfile",
                title: " ",
                width: 800,
                height: 400,
                html: '<iframe id="frame_MyProfile" scrolling="auto" frameborder="0" width="100%" height="100%" src="../MyProfile/MyProfile.aspx"></iframe>',
                maximizable: false,
                resizable: false,
                listeners: {
                    close: function (_this) {
                        if  (navigator.userAgent.indexOf("BIDU") > 0)
                        {
                            alert(window.frames["frame_MyProfile"].document.all("txt_OrderID2").value);
                        }
                        else if (navigator.userAgent.indexOf("Chrome") > 0 || navigator.userAgent.indexOf("Firefox") > 0) {
                            alert(window.frames["frame_MyProfile"].contentWindow.document.getElementById("txt_OrderID2").value);
                        }
                        else {
                            alert(window.frames["frame_MyProfile"].document.all("txt_OrderID2").value);
                        }
                    }
                },

            });
            win.show();
        }


        Ext.onReady(function () {
            Ext.get("btnWindow").on("click", newWin);
            
            Ext.get("btnAlert").on("click", function () {
                Ext.MessageBox.alert(" ", " ExtJS ");
            });
        });

    </script>

htmlコード:
    <input id="btnWindow" type="button" value=" " />
    <input id="btnAlert" type="button" value=" " />

サブフォームコード:
    <div style="display: none">
        <asp:Button ID="btn_Confirm" runat="server" OnClick="btn_Confirm_OnClick" />
        <input id="txt_OrderID2" type="text" value="1200" />
    </div>

    
    <script type="text/javascript">
        

        function closeWin() {
	    document.getElementById("txt_OrderID2").value=100;
            parent.Ext.getCmp('MyProfile').close();
            
        }
    </script>