js对文本框特殊字符串过滤
HTML 中
onkeyup="stripscript(this)";
function stripscript(obj) {
var s = $(obj).val();
var pattern = new RegExp("[`~@#$^&|\\<>/~@#¥&]")
var rs = "";
for (var i = 0; i < s.length; i++) {
rs = rs + s.substr(i, 1).replace(pattern, '');
}
$(obj).val(rs);
}