因为它是一个 textarea ,我在 html 属性中尝试了 cols="50"但它不起作用。
另外,我从上一个问题中找到了答案。他说我可以通过添加来做到这一点。
CKEDITOR.instances.myinstance.resize(1000, 900);
但是,大小仍然没有改变。
这是我尝试的代码,谢谢。
已更新
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script src="../plugin/jquery-1.6.1.min.js"></script>
<script src="../plugin/jquery.validate.min.js"></script>
<script type="text/javascript" src="../plugin/ckeditor/ckeditor.js"></script>
<script>
$(document).ready(function(){
$("#addlist").validate();
var editor = CKEDITOR.replace('editor1');
var div = document.getElementById('editor');
editor.resize($(div).width(),'900');
});
</script>
</head>
<body>
<form method="post" action="confirm.php">
<p><br />
<div id="editor">
<textarea id="editor1" name="editor1">
</div>
<? if (isset($_GET['file']))
{$filepath=$_GET['file'];
require_once("../template/".$filepath);}?> </textarea>
</p>
</br>
File Name </br>
<b>(Naming Without .html e.g. MyTemplate1) :</b>
</br>
<input id="tname" name="tname" class="required" />
<input type="submit" />
</p>
</form>
</body>
</html>
最佳答案
尝试关注
为此,请使用 resize定义编辑器界面尺寸的函数,以像素或 CSS 接受的单位为窗口分配宽度和高度值。
// Set editor width to 100% and height to 350px.
editor.resize( '100%', '350' )
在设置高度值时,使用 isContentHeight 参数来决定该值是适用于整个编辑器界面还是仅适用于编辑区域。
// The height value now applies to the editing area.
editor.resize( '100%', '350', true )
http://docs.cksource.com/CKEditor_3.x/Howto/Editor_Size_On_The_Fly
关于javascript - 如何更改CKEditor的编辑器大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9990157/