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| %>
-
+
-
+
-
+
\ No newline at end of file
diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js
index 22c049ecc..aa958ecb3 100644
--- a/public/javascripts/new_user.js
+++ b/public/javascripts/new_user.js
@@ -340,7 +340,7 @@ function limitStrsize(id,length){
$('#'+id).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) {//大于255的都是中文