0

我有一个主页,并且在此主页中使用 popuppanel(popuppanel 内容页面有一个作为内联 ckeditor 的 div)来显示一些详细信息。如果多次执行相同的代码(即,ckeditor 多次运行),则它可以在除 IE9 之外的所有其他浏览器中运行(即使在 IE8 中也可以运行)。但是,第一次执行是成功的。下面提供了正在使用的代码。

第二次执行时抛出以下错误:

CKEDITOR.inline is undefined
CKEDITOR.document is undefined

[OS-Windows7,浏览器-IE9,ckeditor-v4.0]。

主页

<head runat="server">
    <title>main Page</title>
     <script src="http://code.jquery.com/jquery-2.0.3.js" type="text/javascript"></script>
    <script type="text/javascript">
    function calljs(){
        ifrm1 = document.getElementById("if1");
        ifrm1.setAttribute('src', 'panelPage.aspx');
         $find('pup').show();
        }

    function closebtn(){
        $find('pup').hide();
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
   <ajaxToolkit:ToolkitScriptManager runat="server" EnablePageMethods="true">
   </ajaxToolkit:ToolkitScriptManager>
   <input type="button" onclick="javascript:calljs();return false;" value="Show"/>
       <div>
      <ajaxToolkit:ModalPopupExtender ID="pup" PopupControlID="popupPanel" PopupDragHandleControlID="popupPanel"
            runat="server" Enabled="True" TargetControlID="btnOk" CancelControlID="BtnCancel"
            BackgroundCssClass="PopupBackground" Drag="True">
        </ajaxToolkit:ModalPopupExtender>
        <asp:Button Style="display: none" ID="BtnOk" runat="server"></asp:Button>
        <asp:Button Style="display: none" ID="BtnCancel" runat="server"></asp:Button>
    </div>
    <div>
        <asp:Panel ID="popupPanel" runat="server">
                 <iframe id="if1" src="" class="" style=""></iframe>
        </asp:Panel>
    </div>

    </form>
</body>

弹出页面

<head runat="server">
    <title>Untitled Page</title>
     <script src="http://code.jquery.com/jquery-2.0.3.js" type="text/javascript"></script>
    <script src="ckeditor/ckeditor.js" type="text/javascript"></script>
    <script type="text/javascript">
         $(document).ready(function() {
            CKEDITOR.inline(document.getElementById("ed"),{
                    toolbar: [['Bold', 'Italic']]
             });
        });

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <div id="ed" contenteditable="true">
    <p>dummy Text here</p>
    </div>
     <input type="button" onclick="javascript:parent.closebtn();return false;" value="hide" />
    </div>
    </form>
</body>
4

1 回答 1

0

我找到了这个问题的替代解决方案

只是我在 DIV 中创建了iframe 然后在关闭弹出窗口时删除了 iframe 并重新创建。它工作正常,还解决了许多其他问题,如jquery $ undifend 错误pagemethods 无法在 ie9 中第二次执行弹出窗口等。

变化如下:

主页:

<head runat="server">
    <title>main Page</title>
     <script src="http://code.jquery.com/jquery-2.0.3.js" type="text/javascript"></script>
    <script type="text/javascript">
    function calljs(){
        ifrm1 = document.getElementById("if1");
        ifrm1.setAttribute('src', 'panelPage.aspx');
         $find('pup').show();
        }

    function closebtn(){
        $("#if1").remove();
        $("#iFrameDiv").html("<iframe src=''></iframe>");
        $find('pup').hide();
    }
    </script>
</head>
<body>
    <form id="form1" runat="server">
   <ajaxToolkit:ToolkitScriptManager runat="server" EnablePageMethods="true">
   </ajaxToolkit:ToolkitScriptManager>
   <input type="button" onclick="javascript:calljs();return false;" value="Show"/>
       <div>
      <ajaxToolkit:ModalPopupExtender ID="pup" PopupControlID="popupPanel" PopupDragHandleControlID="popupPanel"
            runat="server" Enabled="True" TargetControlID="btnOk" CancelControlID="BtnCancel"
            BackgroundCssClass="PopupBackground" Drag="True">
        </ajaxToolkit:ModalPopupExtender>
        <asp:Button Style="display: none" ID="BtnOk" runat="server"></asp:Button>
        <asp:Button Style="display: none" ID="BtnCancel" runat="server"></asp:Button>
    </div>
    <div>
        <asp:Panel ID="popupPanel" runat="server">
<div id="iFrameDiv">
                 <iframe id="if1" src="" class="" style=""></iframe>
</div>
        </asp:Panel>
    </div>

    </form>
</body>
于 2013-10-25T14:55:16.987 回答