我有一个主页,并且在此主页中使用 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>