當我們在父頁面中用Window新開一個窗口時,其實對於頁面代碼而言,這個窗口和父頁面是同一頁面。
<div id="MyPopWindow" modal="true" shadow="false" minimizable="false" cache="false" maximizable="false"
collapsible="false" resizable="false" style="width: 50%; margin: 0px; padding: 0px; overflow: auto;"></div>
<script type="text/javascript">
function showWindow(options) {
$("#MyPopWindow").window(options);
}
function closeWindow() {
$("#MyPopWindow").window('close');
}
showWindow({
title: "發佈更新公告",
draggable: false,
closable: true,
width: 700,
height: 630,
href: "${ctx}/affiche/toPublishAffiche"
});
</script>
然後在子頁面中,我們需要用到UEditor編輯器的插件,所以
var ue = UE.getEditor('content', {
autoHeightEnabled: true,
autoFloatEnabled: false,
elementPathEnabled: false,
wordCount: false,
imagePopup: false
});
正常時候,我們都是哪裏需要用到什麼插件就在哪個頁面加上需要的JS之類的就OK了,可這次,我們如果把
<script type="text/javascript" src="${ctx}/resources/js/ueditor/ueditor.config2.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/ueditor/lang/zh-cn/zh-cn.js"></script>
這些JS寫在子頁面中,那麼不好意思頁面是會直接報錯的。
所以這段JS代碼是需要寫在父頁面當中。