2012-11-14 108 views

回答

0

将TinyMCE setContent方法我希望这将帮助你..

// Sets the HTML contents of the activeEditor editor 
tinyMCE.activeEditor.setContent('<span>some</span> html'); 

// Sets the raw contents of the activeEditor editor 
tinyMCE.activeEditor.setContent('<span>some</span> html', {format : 'raw'}); 

// Sets the content of a specific editor (my_editor in this example) 
tinyMCE.get('my_editor').setContent(data); 

// Sets the bbcode contents of the activeEditor editor if the bbcode plugin was added 
tinyMCE.activeEditor.setContent('[b]some[/b] html', {format : 'bbcode'}); 

请TinyMCE的文档http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.setContent

+0

此代码设置tinymce编辑器的内容。但实际上我想改变一个tinymce编辑器中的文本框文本。我GOOGLE了很多,但没有用。 pl帮我 – user1809274

+0

@ user1809274使用文本框ID设置文本,请检查这个小提琴http://jsfiddle.net/3sSVa/这将设置一个文本框内的文本,我希望这会帮助你 – super

0

这并不难。首先,您需要获取编辑器的正文。然后你可以尝试找到你的textarea。作为BIOS的建议它是一个有用的id给你的textarea。这里是必要的代码

var editor = tinymce.get('your_editor_id'); 
$(editor.getBody()).find('textarea#your_textarea_id').innerHTML = 'my_new_text'; 
相关问题