0

在新窗口中打开网页时出现以下 javascript 异常

无法获取属性“appendChild”的值:对象为空或未定义。

我使用 window.open 函数在新窗口中打开我的页面,虽然这个异常只出现在 IE 浏览器中。

以下是我的网页

<%@ Page Title="" Language="C#" AutoEventWireup="true" 
MasterPageFile="~/Page.Master" 
CodeBehind="DocumentForm.aspx.cs" Inherits="Docunet.WebViewer.DocumentForm" %>

<%@ Register Assembly="Atalasoft.dotImage.WebControls" Namespace="Atalasoft.Imaging.WebControls"
    TagPrefix="cc1" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="head" ContentPlaceHolderID="headContentPlaceHolder" runat="server">

    <link href='<%# "Styles/DocumentFormStyles" + this.GetGlobalResourceObject("Layout", "Culture").ToString() + ".css"  %>' rel="stylesheet" type="text/css" />

</asp:Content>

<asp:Content ID="content" ContentPlaceHolderID="contentContentPlaceHolder" runat="server">

    <div id="mainTitleBox" class="MainTitleBox">
        <asp:Label ID="mainTitleLabel" runat="server" 
            class="MainTitle"  
            meta:resourceKey="mainTitleLabel" Text=""></asp:Label>
    </div>
    <asp:UpdatePanel ID="updatePanel" runat="server">
        <ContentTemplate>
            <div id="viewBox" class="ViewBox">
                <div class="instanceDataBox">
                    <asp:TabContainer ID="tabContainer" runat="server" ActiveTabIndex="0" >
                        <asp:TabPanel ID="generalTabPanel" runat="server"  
                            CssClass="Text"
                            meta:resourceKey="generalTabPanel" HeaderText="" >
                            <ContentTemplate> 
                                <div class="Text">
                                    <p class='<%# this.ReadRecordMode ? "DataParagraph" : "EditModeDataParagraph" %>'>
                                        <asp:Label ID="numberTitleLabel" runat="server" 
                                            CssClass="titleControl" 
                                            meta:resourceKey="numberTitleLabel" Text="<%# this.NumberFieldName %>" ></asp:Label>
                                        <asp:Label ID="numberLabel" runat="server" 
                                            CssClass="valueControl" 
                                            Visible="<%# this.ReadRecordMode %>"></asp:Label>
                                        <br />
                                    </p>
                                    <p class='<%# this.ReadRecordMode ? "DataParagraph" : "EditModeDataParagraph" %>'>
                                        <asp:Label ID="yearTitleLabel" runat="server" 
                                            CssClass="titleControl" 
                                            meta:resourceKey="yearTitleLabel" Text="<%# this.YearFieldName %>" ></asp:Label>
                                        <asp:Label ID="yearLabel" runat="server" 
                                            CssClass="valueControl" 
                                            Visible="<%# this.ReadRecordMode %>"></asp:Label>
                                        <br />
                                    </p>
                                    <p class='<%# this.ReadRecordMode ? "DataParagraph" : "EditModeDataParagraph" %>'>
                                        <asp:Label ID="codeTitleLabel" runat="server" 
                                            CssClass="titleControl" 
                                            meta:resourceKey="codeTitleLabel" Text="<%# this.CodeFieldName %>" ></asp:Label>
                                        <asp:Label ID="codeLabel" runat="server" 
                                            CssClass="valueControl" 
                                            Visible="<%# this.ReadRecordMode %>"></asp:Label>
                                        <br />
                                    </p>
                                    <p class='<%# this.ReadRecordMode ? "DataParagraph" : "EditModeDataParagraph" %>'>
                                        <asp:Label ID="categoryTitleLabel" runat="server" 
                                            CssClass="titleControl" 
                                            meta:resourceKey="categoryTitleLabel" Text="<%# this.CategoryFieldName %>" ></asp:Label>
                                        <asp:Label ID="categoryLabel" runat="server" 
                                            CssClass="valueControl" 
                                            Visible="<%# this.ReadRecordMode %>"></asp:Label>
                                        <br />
                                    </p>
                                    <p class='<%# this.ReadRecordMode ? "DataParagraph" : "EditModeDataParagraph" %>'>
                                        <asp:Label ID="dateTitleLabel" runat="server" 
                                            CssClass="titleControl" 
                                            meta:resourceKey="dateTitleLabel" Text="<%# this.DateFieldName %>" ></asp:Label>
                                        <asp:Label ID="dateLabel" runat="server" 
                                            CssClass="valueControl" 
                                            Visible="<%# this.ReadRecordMode %>"></asp:Label>
                                        <br />
                                    </p>
                                    <p class='<%# this.ReadRecordMode ? "DataParagraph" : "EditModeDataParagraph" %>'>
                                        <asp:Label ID="archiveDocumentTitleLabel" runat="server" 
                                            CssClass="titleControl" 
                                            meta:resourceKey="archiveDocumentTitleLabel" Text="<%# this.ArchiveDocumentFieldName %>" ></asp:Label>
                                        <asp:Label ID="archiveDocumentLabel" runat="server" 
                                            CssClass="valueControl" 
                                            Visible="<%# this.ReadRecordMode %>"></asp:Label>
                                        <br />
                                    </p>
                                    <p class='<%# this.ReadRecordMode ? "DataParagraph" : "EditModeDataParagraph" %>' style="height:70px;" >
                                        <asp:Label ID="subjectTitleLabel" runat="server" 
                                            CssClass="titleControl"
                                            meta:resourceKey="subjectTitleLabel" Text="<%# this.SubjectFieldName %>" ></asp:Label>
                                        <asp:Label ID="subjectLabel" runat="server" 
                                            CssClass="valueControl" 
                                            Visible="<%# this.ReadRecordMode %>"></asp:Label>
                                        <br />
                                    </p>
                                    <p class='<%# this.ReadRecordMode ? "DataParagraph" : "EditModeDataParagraph" %>' style="height:70px;" >
                                        <asp:Label ID="notesTitleLabel" runat="server" 
                                            CssClass="titleControl" 
                                            meta:resourceKey="notesTitleLabel" Text="<%# this.NotesFieldName %>" ></asp:Label>
                                        <asp:Label ID="notesLabel" runat="server" 
                                            CssClass="valueControl" 
                                            Visible="<%# this.ReadRecordMode %>"></asp:Label>
                                        <br />
                                    </p>
                                    <p class='<%# this.ReadRecordMode ? "DataParagraph" : "EditModeDataParagraph" %>'>
                                        <asp:Label ID="mainDocumentNumberTitleLabel" runat="server" 
                                            CssClass="titleControl" 
                                            meta:resourceKey="mainDocumentNumberTitleLabel" Text="<%# this.MainDocumentNumberFieldName %>" ></asp:Label>
                                        <asp:Label ID="mainDocumentNumberLabel" runat="server" 
                                            CssClass="valueControl" 
                                            Visible="<%# this.ReadRecordMode %>"></asp:Label>
                                        <br />
                                    </p>
                                    <p class='<%# this.ReadRecordMode ? "DataParagraph" : "EditModeDataParagraph" %>'>
                                        <asp:Label ID="mainDocumentDateTitleLabel" runat="server" 
                                            CssClass="titleControl" 
                                            meta:resourceKey="mainDocumentDateTitleLabel" Text="<%# this.MainDocumentDateFieldName %>" ></asp:Label>
                                        <asp:Label ID="mainDocumentDateLabel" runat="server" 
                                            CssClass="valueControl" 
                                            Visible="<%# this.ReadRecordMode %>"></asp:Label>
                                        <br />
                                    </p>
                                </div>
                            </ContentTemplate>
                        </asp:TabPanel>
                        <asp:TabPanel ID="relatedDocumentsTabPanel" runat="server"  
                            CssClass="Text"
                            meta:resourceKey="relatedDocumentsTabPanel" HeaderText="" >
                            <ContentTemplate> 
                                <div class="Text">
                                    <asp:GridView ID="relatedDocumentsGridView" runat="server" 
                                        BorderWidth="0px" GridLines="Horizontal"
                                        AutoGenerateColumns="False" ShowHeaderWhenEmpty="true"
                                        DataKeyNames="ID"
                                        onrowdatabound="relatedDocumentsGridView_RowDataBound" 
                                        onselectedindexchanged="gridView_SelectedIndexChanged" >
                                        <Columns>
                                            <asp:BoundField DataField="ID" Visible="false" />
                                            <asp:TemplateField meta:resourceKey="relatedDocumentsGridViewColorField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle RelatedDocumentColorGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle RelatedDocumentColorGridViewItem" />
                                                <ItemTemplate>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="SerialNumber" meta:resourceKey="relatedDocumentsGridViewSerialNumberField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle RelatedDocumentSerialNumberGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle RelatedDocumentSerialNumberGridViewItem" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="Code" meta:resourceKey="relatedDocumentsGridViewCodeField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle RelatedDocumentCodeGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle RelatedDocumentCodeGridViewItem" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="Subject" meta:resourceKey="relatedDocumentsGridViewSubjectField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle RelatedDocumentSubjectGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle RelatedDocumentSubjectGridViewItem" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="DateAsString" meta:resourceKey="relatedDocumentsGridViewCreationDateField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle RelatedDocumentCreationDateGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle RelatedDocumentCreationDateGridViewItem" />
                                            </asp:BoundField>
                                        </Columns>
                                        <EmptyDataTemplate>
                                            <div>
                                                <a> <%# this.GetGlobalResourceObject("Messages", "EmptyList") %> </a>
                                            </div>
                                        </EmptyDataTemplate>
                                        <PagerSettings Visible="False" />
                                        <RowStyle CssClass="gridViewRow" />
                                        <SelectedRowStyle CssClass="selectedGridViewRow" />
                                    </asp:GridView>
                                </div>
                            </ContentTemplate>
                        </asp:TabPanel>
                        <asp:TabPanel ID="attachmentsTabPanel" runat="server"  
                            CssClass="Text"
                            meta:resourceKey="attachmentsTabPanel" HeaderText="" >
                            <ContentTemplate> 
                                <div class="Text">
                                    <asp:DataList ID="documentAttachmentsDataList" runat="server" Height="78px" 
                                        RepeatDirection="Horizontal" Width="62px" RepeatColumns="5">
                                        <ItemTemplate>
                                            <div align="center">
                                                <asp:Image ID="imgAttach"  ImageUrl='<%# isAvail(Eval("ATTTYPE", "~/Images/{0}.jpg"))%>'  Width="100px" Height="100px" runat="server" />
                                            </div>
                                            <div align="center">
                                                <asp:LinkButton ID="lbAttach" runat="server" Text="<%# Bind('NAME') %>" onclick="lbAttach_Click" Font-Size="16"></asp:LinkButton>
                                                <asp:Label ID="lblID" style='display:none'  runat="server" Text="<%# Bind('ID') %>"></asp:Label>
                                            </div>
                                        </ItemTemplate>
                                    </asp:DataList>                                    
                                    <asp:GridView ID="attachmentsGridView" runat="server" 
                                        BorderWidth="0px" GridLines="Horizontal"
                                        AutoGenerateColumns="False" ShowHeaderWhenEmpty="true"
                                        DataKeyNames="ID"
                                        onrowdatabound="gridView_RowDataBound" 
                                        onselectedindexchanged="gridView_SelectedIndexChanged" >
                                        <Columns>
                                            <asp:BoundField DataField="ID" Visible="false" />
                                            <asp:BoundField DataField="NAME" meta:resourceKey="attachmentsGridViewNameField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle AttachmentNameGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle AttachmentNameGridViewItem" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="CREATEDATE" meta:resourceKey="attachmentsGridViewCreationDateField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle AttachmentCreationDateGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle AttachmentCreationDateGridViewItem" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="FILENAME" meta:resourceKey="attachmentsGridViewFileField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle AttachmentFileGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle AttachmentFileGridViewItem" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="ATTTYPE" meta:resourceKey="attachmentsGridViewFileTypeField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle AttachmentFileTypeGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle AttachmentFileTypeGridViewItem" />
                                            </asp:BoundField>
                                        </Columns>
                                        <EmptyDataTemplate>
                                            <div>
                                                <a> <%# this.GetGlobalResourceObject("Messages", "EmptyList") %> </a>
                                            </div>
                                        </EmptyDataTemplate>
                                        <PagerSettings Visible="False" />
                                        <RowStyle CssClass="gridViewRow" />
                                        <SelectedRowStyle CssClass="selectedGridViewRow" />
                                    </asp:GridView>
                                </div>
                            </ContentTemplate>
                        </asp:TabPanel>
                        <asp:TabPanel ID="imagesTabPanel" runat="server"  
                            CssClass="Text"
                            meta:resourceKey="imagesTabPanel" HeaderText="" >
                            <ContentTemplate> 
                                <table style="border:1px solid black; width:100%;" >
                                    <tr> 
                                        <td style="vertical-align:top; border-right:1px solid black; width:295px;">
                                            <cc1:WebThumbnailViewer ID="documentImageWebThumbnailViewer" runat="server"
                                                Height="500px"
                                                ViewerID="documentImagesWebImageViewer"
                                                OnSelectedIndexChanged="documentImageWebThumbnailViewer_SelectedIndexChanged" />
                                        </td>
                                        <td style="vertical-align:top;">
                                            <cc1:WebImageViewer ID="documentImagesWebImageViewer" runat="server"
                                                Height="500px" Width="100%" />
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </asp:TabPanel>
                        <asp:TabPanel ID="copiesTabPanel" runat="server"  
                            CssClass="Text"
                            meta:resourceKey="copiesTabPanel" HeaderText="" >
                            <ContentTemplate> 
                                <div class="Text">
                                    <asp:GridView ID="copiesGridView" runat="server" 
                                        BorderWidth="0px" GridLines="Horizontal"
                                        AutoGenerateColumns="False" ShowHeaderWhenEmpty="true"
                                        DataKeyNames="ID"
                                        onrowdatabound="gridView_RowDataBound" 
                                        onselectedindexchanged="gridView_SelectedIndexChanged" >
                                        <Columns>
                                            <asp:BoundField DataField="ID" Visible="false" />
                                            <asp:BoundField DataField="SerialNumber" meta:resourceKey="copiesGridViewSerialNumberField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle CopiesSerialNumberGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle CopiesSerialNumberGridViewItem" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="TargetType" meta:resourceKey="copiesGridViewTargetTypeField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle CopiesTargetTypeGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle CopiesTargetTypeGridViewItem" />
                                            </asp:BoundField>
                                            <asp:BoundField DataField="Target" meta:resourceKey="copiesGridViewTargetNameField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle CopiesTargetNameGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle CopiesTargetNameGridViewItem" />
                                            </asp:BoundField>
                                        </Columns>
                                        <EmptyDataTemplate>
                                            <div>
                                                <a> <%# this.GetGlobalResourceObject("Messages", "EmptyList") %> </a>
                                            </div>
                                        </EmptyDataTemplate>
                                        <PagerSettings Visible="False" />
                                        <RowStyle CssClass="gridViewRow" />
                                        <SelectedRowStyle CssClass="selectedGridViewRow" />
                                    </asp:GridView>
                                </div>
                            </ContentTemplate>
                        </asp:TabPanel>
                        <asp:TabPanel ID="additionalFieldsTabPanel" runat="server"  
                            CssClass="Text"
                            meta:resourceKey="additionalFieldsTabPanel" HeaderText="" >
                            <ContentTemplate> 
                                <div class="Text">
                                    <asp:GridView ID="additionalFieldsGridView" runat="server" 
                                        BorderWidth="0px" GridLines="Horizontal"
                                        AutoGenerateColumns="False" ShowHeaderWhenEmpty="true"
                                        DataKeyNames="ID"
                                        onrowdatabound="gridView_RowDataBound" 
                                        onselectedindexchanged="gridView_SelectedIndexChanged" >
                                        <Columns>
                                            <asp:BoundField DataField="ID" Visible="false" />
                                            <asp:BoundField DataField="Name" meta:resourceKey="additionalFieldsGridViewNameField" HeaderText="" >
                                                <HeaderStyle CssClass="gridViewHeaderStyle AdditionalFieldNameGridViewHeader" />
                                                <ItemStyle CssClass="gridViewItemStyle AdditionalFieldNameGridViewItem" />
                                            </asp:BoundField>

                                        <asp:BoundField DataField="Value" meta:resourceKey="additionalFieldsGridViewValueField" HeaderText="" >
                                            <HeaderStyle CssClass="gridViewHeaderStyle AdditionalFieldValueGridViewHeader" />
                                            <ItemStyle CssClass="gridViewItemStyle AdditionalFieldValueGridViewItem" />
                                        </asp:BoundField>
                                    </Columns>
                                    <EmptyDataTemplate>
                                        <div>
                                            <a> <%# this.GetGlobalResourceObject("Messages", "EmptyList") %> </a>
                                        </div>
                                    </EmptyDataTemplate>
                                    <PagerSettings Visible="False" />
                                    <RowStyle CssClass="gridViewRow" />
                                    <SelectedRowStyle CssClass="selectedGridViewRow" />
                                </asp:GridView>
                            </div>
                        </ContentTemplate>
                    </asp:TabPanel>                        
                </asp:TabContainer>
            </div>
        </div>
    </ContentTemplate>
</asp:UpdatePanel> 

4

1 回答 1

0

您正在加载的页面必须包含一些 javascript 函数,您在其中尝试将子项附加到未初始化的对象。

其他浏览器将忽略该错误并在 IE 中断时继续加载。在 javascript 中调试您的 OnLoad 代码并找到发生这种情况的位置。

只需添加以下检查:

    if(myObj != undefined){
        myObj.AppendChild(child)
    }
于 2013-01-29T07:27:56.967 回答