Es decir tengo una serie de radiobuton con asuntos, y en funcion del que se pulsa poder variar el contenido del CKEditor.
he probado con esto:
Código HTML:
function publicar(seccion) { if (seccion == "S") { document.getElementById('asunto').value="Bienvenido"; var writer = new CKEDITOR.htmlWriter(); writer.text( "Hola S" ); writer.getHtml();"; } else { document.getElementById('asunto').value="Pendiente"; var writer = new CKEDITOR.htmlWriter(); writer.text( "Hola N" ); writer.getHtml(); } }
Código HTML:
<textarea name="cuerpo" id="cuerpo" rows="5" cols="70" class="C9"> Hola S </textarea> <!--*****************************Editor de Texto*****************************--> <script type="text/javascript"> CKEDITOR.replace('cuerpo', { toolbar : [ ['Source','-','Save','NewPage','Preview','-','Templates'], ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], '/', ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Anchor'], ['Table','HorizontalRule','Smiley','SpecialChar','PageBreak'], '/', ['Styles','Format','Font','FontSize'], ['TextColor','BGColor'], ['Maximize', 'ShowBlocks','-'] ] }); </script>