diff --git a/app/views/forums/edit.html.erb b/app/views/forums/edit.html.erb
index c212e7b9d..1fcbc6cab 100644
--- a/app/views/forums/edit.html.erb
+++ b/app/views/forums/edit.html.erb
@@ -1,23 +1,7 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'new_user' %>
\ No newline at end of file
diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb
index 8f5cb15cc..bb531b85c 100644
--- a/app/views/forums/index.html.erb
+++ b/app/views/forums/index.html.erb
@@ -49,7 +49,7 @@
$("#reorder_popu").removeClass("sortArrowActiveD");
add_class("reorder_time");
});
- document.getElementById('forum_name').onkeydown = function()
+ $('#forum_name').keypress( function(e)
{
var n = 0;
var str = this.value;
@@ -61,9 +61,16 @@
n += 1;//英文,不多说了
}
}
- if(n >= 160 && event.keyCode != 8)
- event.returnValue = false;
- }
+ if(n >= 160 && e.keyCode != 8)
+ if(document.all)
+ {
+ e.returnValue = false;
+ }
+ else
+ {
+ e.preventDefault();
+ }
+ })
});
function check_and_submit(doc){
$("#error").html('').hide();
diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js
index d2b67be5e..22c049ecc 100644
--- a/public/javascripts/new_user.js
+++ b/public/javascripts/new_user.js
@@ -337,7 +337,7 @@ var autoTextarea = function (elem, extra, maxHeight) {
};
function limitStrsize(id,length){
- document.getElementById(id).onkeydown = function()
+ $('#'+id).keypress(function(e)
{
var n = 0;
var str = this.value;
@@ -350,9 +350,16 @@ function limitStrsize(id,length){
}
}
- if(n >= length && event.keyCode !== 8)
- event.returnValue = false;
- }
+ if(n >= length && e.keyCode !== 8)
+ if(document.all)
+ {
+ e.returnValue = false;
+ }
+ else
+ {
+ e.preventDefault();
+ }
+ })
}
/////////////////////////////////////////////////////////////////////////////////////创建项目