Skip to content


让tinymce中的链接默认为新窗口方式

方法一:使用tinymce的函数setupcontent_callback 在内容的开头增加

function myCustomSetupContent(editor_id, body, doc) {
    body.innerHTML = "" + body.innerHTML;
}

tinyMCE.init({
    ...
    setupcontent_callback : "myCustomSetupContent"
});
方法二:在程序入库前在内容的开头增加

以php为例

$Content = "" +$Content;

 

方法三:修改tiny_mce.js文件valid_elements中a属性的默认target属性为_blank
使用未压缩片的文件是tiny_mce_src.js.

,a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target
=_blank|

 

 

总结:
tinymce版本为3 0rc1

方法一和二的base方式在FF中有效,IE下需把放在前,并对以后的所有链接都有效,所以效果欠佳。

方法三比较好。

Posted in JavaScript/DOM/XML, 技术.

Tagged with , .


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.