服務(wù)熱線
153 8323 9821
fckeditor 中,處理圖片在fckeditor中顯示問(wèn)題,以前是在頁(yè)面頭部防止下面代碼:
<script type="text/javascript">
function SetEditorContents(ContentStr) {
var oEditor = FCKeditorAPI.GetInstance("ck") ;
oEditor.InsertHtml("<img src=" + ContentStr + " />");
}
</script>
后來(lái)有的用戶升級(jí)系統(tǒng)后用到了 ie9或者ie10,后臺(tái)就出現(xiàn)一些錯(cuò)誤,比如點(diǎn)擊源碼無(wú)反應(yīng)等,雖然問(wèn)題最終也能解決,可是考慮到ckeditor是fckeditor的升級(jí),為了一勞永逸的解決問(wèn)題,最終還是覺定放棄fckeditor而是用ckeditor,更新后后臺(tái)的一些小問(wèn)題解決了,而上面的那個(gè)問(wèn)題還是沒解決,因?yàn)橐呀?jīng)換成ckeditor了,FCKeditorAPI肯定是無(wú)法是用了,這樣,經(jīng)過(guò)查閱一些資料再根據(jù)自己的測(cè)試整理,終于解決了問(wèn)題,也就是把上面的代碼更換為下面的即可:
<script type="text/javascript">
function SetEditorContents(ContentStr) {
var oEditor = CKEDITOR.instances.ck;
oEditor.insertHtml("<img src=" + ContentStr + " />");
}
</script>
或者更簡(jiǎn)單的用下面的辦法,其實(shí)與上面的是一樣的
<script type="text/javascript">
function SetEditorContents(ContentStr) {
CKEDITOR.instances.ck.insertHtml("<img src=" + ContentStr + " />");
}
</script>
其中ck是頁(yè)面文件中ckeditor的ID名,在看其他問(wèn)題的一些說(shuō)明中,有的朋友寫的是content讓我誤以為是ckeditor的一個(gè)屬性多浪費(fèi)了一些時(shí)間,我就把這個(gè)改成這個(gè)名字,方便理解。
這是今天解決的一個(gè)問(wèn)題,方便以后查看,并為也遇到這個(gè)問(wèn)題的朋友提醒一下
上一篇:正則表達(dá)式判斷