|
|
|
@ -51,8 +51,9 @@
|
|
|
|
|
});
|
|
|
|
|
$('#forum_name').keypress( function(e)
|
|
|
|
|
{
|
|
|
|
|
alert(1)
|
|
|
|
|
var n = 0;
|
|
|
|
|
var str = this.value;
|
|
|
|
|
var str = this.val().trim();
|
|
|
|
|
for (i = 0; i < str.length; i++) {
|
|
|
|
|
var leg = str.charCodeAt(i);//ASCII码
|
|
|
|
|
if (leg > 255) {//大于255的都是中文
|
|
|
|
@ -61,6 +62,7 @@
|
|
|
|
|
n += 1;//英文,不多说了
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log(n)
|
|
|
|
|
if(n >= 160 && e.keyCode != 8)
|
|
|
|
|
if(document.all)
|
|
|
|
|
{
|
|
|
|
@ -136,14 +138,14 @@
|
|
|
|
|
<div class="red fl mb10" id="error" style="display: none">error</div>
|
|
|
|
|
<%= form_tag({:controller => 'forums',:action=>'create',:format=>'js'},:method => 'post',:remote=>'true') do |f| %>
|
|
|
|
|
<div class="mt15">
|
|
|
|
|
<textarea type="text" name="forum[name]" id="forum_name" class="postCreateInput" onfocus="hideError();" onblur="check_forum_name();" placeholder="输入贴吧名称" ></textarea>
|
|
|
|
|
<textarea type="text" name="forum[name]" id="forum_name" maxlength="80" class="postCreateInput" onfocus="hideError();" onblur="check_forum_name();" placeholder="输入贴吧名称" ></textarea>
|
|
|
|
|
<script>
|
|
|
|
|
var textarea = document.getElementById('forum_name');
|
|
|
|
|
autoTextarea(textarea);
|
|
|
|
|
</script>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mt15">
|
|
|
|
|
<textarea type="text" name="forum[description]" id="forum_desc" class="postCreateInput" placeholder="输入贴吧描述"></textarea>
|
|
|
|
|
<textarea type="text" name="forum[description]" id="forum_desc" maxlength="5000" class="postCreateInput" placeholder="输入贴吧描述"></textarea>
|
|
|
|
|
<script>
|
|
|
|
|
var textarea1 = document.getElementById('forum_desc');
|
|
|
|
|
autoTextarea(textarea1);
|
|
|
|
|