2013-10-23 35 views
0

我有一個主頁面和popuppanel(popuppanel內容頁面有一個div作爲內聯ckeditor)在這個主頁面中用來顯示一些細節。如果多次執行相同的代碼(即ckeditor可以多次運行),它可以在所有其他瀏覽器上運行,而不是IE9(即使在IE8中也是如此)。但是,第一次執行是成功的。下面提供了正在使用的代碼。從第二時間執行在IE9瀏覽器中的嵌入式ckeditor只能使用一次(在彈出式面板中)

以下錯誤擲:

CKEDITOR.inline is undefined 
CKEDITOR.document is undefined 

[OS-Windows 7中,瀏覽器的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> 

popuppage

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

回答

0

我找到了一個替代的解決方案針對此問題

只是我創建IFRAME一個DIV裏面和我刪除了iframe,並在關閉彈出窗口時重新創建。它的做工精細並且還解決了許多其他問題一樣jQuery的$ undifend錯誤pagemethods在第二次彈出執行不工作在IE9等下面

變化:

的MainPage:

<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> 
相關問題