我使用jquery
将chek编辑器加载到.php外部文件中 <script src='../js/jquery-2.0.0.js' type='text/javascript'></script>
<div id='cippa'>
<script>
$('#cippa').click(function(){
// load page on click
$('#cippa').load('edit_news_inc.php?id_user=".$id_user."&id=".$news[$n]['id']."&file_id=N&type=body_it&save=0&field=body_it');
});
</script>
<a href='javascript:void()' id='cippa'>
在我调用的.php文件中:
<script src='../ckeditor/ckeditor.js'></script>
<form name=".$type." method=post action='add_news.php?id_user=".$id_user."&id=".$id."&file_id=N&type=".$type."&save=1&field=".$type."'>
<textarea id='pippo' name=\"body_it\" cols=50 rows=4>".utf8_encode($news[$n]['body_it'])."</textarea>
<script>
CKEDITOR.replace( 'pippo', {
language: 'it',
// uiColor: '#14B8C4',
enterMode: CKEDITOR.ENTER_BR
} );
</script>
<input type='submit' class='inputButtonAdmin' value='Save body IT'>
</form>
如果我编辑文本但是如果我尝试使用工具栏(即B或斜体),则一切正常,它会重新加载编辑器并失去更改。我做错了什么?
答案 0 :(得分:0)
解决了它,如果它可以帮助某人
<script src='/js/jquery-2.0.0.js' type='text/javascript'></script>
<div id='body_it'>
<span class='orange'>Corpo Italiano:<a href='#' id='reg_link'>OKOKOKOKOK</a>
<img src='/images/edit.png' height=18 width=18 alt='edit'><span class='black'>(".$lang['edit'].")</span></a></span>
<br>".utf8_encode($news[$n]['body_it'])."
</div>
<script>
$('#reg_link').click(function(e) {
e.preventDefault();
$('#body_it').load('edit_news_inc.php?id_user=".$id_user."&id=".$news[$n]['id']."&file_id=N&type=body_it&save=0&field=body_it');
});
</script>
和外部.php文件
<script src='../ckeditor/ckeditor.js'></script>
<form name=".$type." method=post action='add_news.php?id_user=".$id_user."&id=".$id."&file_id=N&type=".$type."&save=1&field=".$type."'>
<p>
<textarea name='body_it' class='ckeditor'>".utf8_encode($news[$n]['body_it'])."</textarea>
<script>
CKEDITOR.instance( 'body_it', {
language: 'it',
// uiColor: '#14B8C4',
enterMode: CKEDITOR.ENTER_BR
} );
</script>
</p>
<p>
<input type='submit' class='inputButtonAdmin' value='Save body IT'>
</form>
</p>