我想创建两个文本框,如果有人写了一些文本 前50个字符应该在第一个文本框中 接下来输入的内容应该去 下一个文本框两个文本框一个字符数有限其他文本框剩余的
jQuery中或Javascript的代码看起来是这样的
VAR的content_id = 'editable_div';
max = 50;
//binding keyup/down events on the contenteditable div
$('#'+content_id).keyup(function(e){ check_charcount(content_id, max, e); });
$('#'+content_id).keydown(function(e){ check_charcount(content_id, max, e); });
function check_charcount(content_id, max, e)
{
if(e.which != 50 && $('#'+content_id).text().length > max)
{
//the remaining part focusing the mouse on to the next div let the id of the next editable div be next
e.preventDefault();
}
}
SO是问问题,而不是某个地方来记录您的愿望清单的地方。证明你至少试图建立这个系统,我们将尽力帮助解决它。但是现在你只是另一个“给编码”的freeloader。 – 2012-08-17 17:05:44