From 959d3f1a93bfce658be746e9e422abffb28b4c11 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 25 Sep 2015 16:11:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=87=E4=B8=80=E9=95=BF=E5=BA=A6?= =?UTF-8?q?=E8=BF=87=E5=A4=A7=EF=BC=8C=E9=98=BB=E6=AD=A2=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/memos/edit.html.erb | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/app/views/memos/edit.html.erb b/app/views/memos/edit.html.erb index 0efa57ccc..4a515ee1f 100644 --- a/app/views/memos/edit.html.erb +++ b/app/views/memos/edit.html.erb @@ -1,11 +1,16 @@ <%= javascript_include_tag 'new_user'%> \ No newline at end of file From e0c338b497649e67b47c4a7024dd2032838a911f Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 25 Sep 2015 16:20:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=99=90=E5=88=B6=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/forums/_form_edit_mode.html.erb | 4 ++-- app/views/forums/edit.html.erb | 2 +- app/views/forums/index.html.erb | 8 +++++--- app/views/forums/show.html.erb | 4 ++-- public/javascripts/new_user.js | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/views/forums/_form_edit_mode.html.erb b/app/views/forums/_form_edit_mode.html.erb index 9c0ec27bd..ade5a24c4 100644 --- a/app/views/forums/_form_edit_mode.html.erb +++ b/app/views/forums/_form_edit_mode.html.erb @@ -9,10 +9,10 @@
- +
- +
确定
diff --git a/app/views/forums/edit.html.erb b/app/views/forums/edit.html.erb index 1fcbc6cab..07570b687 100644 --- a/app/views/forums/edit.html.erb +++ b/app/views/forums/edit.html.erb @@ -54,7 +54,7 @@ $('#forum_name').keypress(function(e) { 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) { diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index bb531b85c..055b83f50 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -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 @@ <%= form_tag({:controller => 'forums',:action=>'create',:format=>'js'},:method => 'post',:remote=>'true') do |f| %>
- +
- +
- +