Javascript IE9浏览器中的内联ckeditor只能工作一次(在弹出面板中)

Javascript IE9浏览器中的内联ckeditor只能工作一次(在弹出面板中),javascript,jquery,ckeditor,inline,modalpopup,Javascript,Jquery,Ckeditor,Inline,Modalpopup,我有一个主页,在这个主页中使用了popuppanel(popuppanel内容页有一个作为内联编辑器的div)来显示一些细节。如果同一代码执行多次(即,ckeditor工作多次),则它在除IE9之外的所有其他浏览器中都能工作(即使在IE8中也能工作)。但是,第一次执行是成功的。下面提供了正在使用的代码 从第二次执行时抛出以下错误: CKEDITOR.inline is undefined CKEDITOR.document is undefined <head runat="server

我有一个主页,在这个主页中使用了popuppanel(popuppanel内容页有一个作为内联编辑器的div)来显示一些细节。如果同一代码执行多次(即,ckeditor工作多次),则它在除IE9之外的所有其他浏览器中都能工作(即使在IE8中也能工作)。但是,第一次执行是成功的。下面提供了正在使用的代码

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

CKEDITOR.inline is undefined
CKEDITOR.document is undefined
<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>
[OS-Windows7、browser-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>

主页
函数calljs(){
ifrm1=document.getElementById(“if1”);
ifrm1.setAttribute('src','panelPage.aspx');
$find('pup').show();
}
函数closebtn(){
$find('pup').hide();
}
pouppage

<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>

无标题页
$(文档).ready(函数(){
CKEDITOR.inline(document.getElementById(“ed”){
工具栏:[“粗体”、“斜体”]]
});
});
这里是虚拟文本


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

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

变化如下:

主页:

CKEDITOR.inline is undefined
CKEDITOR.document is undefined
<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>

主页
函数calljs(){
ifrm1=document.getElementById(“if1”);
ifrm1.setAttribute('src','panelPage.aspx');
$find('pup').show();
}
函数closebtn(){
$(“#if1”).remove();
$(“#iFrameDiv”).html(“”);
$find('pup').hide();
}