有人用过用ckeditor 替换<html:textarea></html:textarea>中的内容,并实现回显吗? 5
1个回答
展开全部
<head>
...
<script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
</head>
<textarea id="editor1" name="editor1"><p>Initial value.</p></textarea>
<script type="text/javascript">
CKEDITOR.replace( 'editor1' );
</script>
得到内容
<script type="text/javascript">
var editor_data = CKEDITOR.instances.editor1.getData();
</script>
完整例子:
<html>
<head>
<title>Sample CKEditor Site</title>
<script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
</head>
<body>
<form method="post">
<p>
My Editor:<br />
<textarea id="editor1" name="editor1"><p>Initial value.</p></textarea>
<script type="text/javascript">
CKEDITOR.replace( 'editor1' );
</script>
</p>
<p>
<input type="submit" />
</p>
</form>
</body>
</html>
...
<script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
</head>
<textarea id="editor1" name="editor1"><p>Initial value.</p></textarea>
<script type="text/javascript">
CKEDITOR.replace( 'editor1' );
</script>
得到内容
<script type="text/javascript">
var editor_data = CKEDITOR.instances.editor1.getData();
</script>
完整例子:
<html>
<head>
<title>Sample CKEditor Site</title>
<script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
</head>
<body>
<form method="post">
<p>
My Editor:<br />
<textarea id="editor1" name="editor1"><p>Initial value.</p></textarea>
<script type="text/javascript">
CKEDITOR.replace( 'editor1' );
</script>
</p>
<p>
<input type="submit" />
</p>
</form>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询