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] =?UTF-8?q?=E9=99=90=E5=88=B6=E5=AD=97=E7=AC=A6=E9=95=BF?=
=?UTF-8?q?=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 @@
error
<%= form_tag({:controller => 'forums',:action=>'create',:format=>'js'},:method => 'post',:remote=>'true') do |f| %>
-
+
-
+
-
+