内容可编辑iframe可编辑高度限制
我正在使用yui编辑器。我想知道是否可以限制可编辑高度区域 高度:300px,超过300px时,卡雷特停止书写内容可编辑iframe可编辑高度限制,iframe,yui,contenteditable,Iframe,Yui,Contenteditable,我正在使用yui编辑器。我想知道是否可以限制可编辑高度区域 高度:300px,超过300px时,卡雷特停止书写 谢谢这是一个可以在iExplorer、Firefox和Crome上运行的简单jQuery: $('#my_frame').load(function () { $(this).height($(this).contents().find("html").height()+20); }); 我添加20像素只是为了避免任何滚动条,但您可以尝试一个下限 htm
谢谢这是一个可以在iExplorer、Firefox和Crome上运行的简单jQuery:
$('#my_frame').load(function () {
$(this).height($(this).contents().find("html").height()+20);
});
我添加20像素只是为了避免任何滚动条,但您可以尝试一个下限
html:
<textarea id="countMe" cols="30" rows="5"></textarea>
<div class="theCount">Lines used: <span id="linesUsed">0</span><div>js:
}))
当用户输入字符并计算长度时,您可以在编辑器面板上执行一些代码,如果超出限制,则返回false。您不需要限制区域?您正在设置可编辑区域高度(iframe)。我已经可以这样做了:var myConfig={height:'200px'};var myEditor=newyahoo.widget.Editor('Editor',myConfig);myEditor.render();我想将可编辑区域中的文本限制为200px。超过200px如果按“回车”键,它将返回false,因此不会创建其他新行。换句话说,如果我有一个200 px(高度)的可编辑区域,我只希望该区域用于编辑文本。(无滚动、无新行、无溢出)
var lines = 10;
var linesUsed = $('#linesUsed');
$('#countMe').keydown(function(e) {
newLines = $(this).val().split("\n").length;
linesUsed.text(newLines);
if(e.keyCode == 13 && newLines >= lines) {
linesUsed.css('color', 'red');
return false;
}
else {
linesUsed.css('color', '');
}
});