//不能输入全角字符
function quanjiao(obj){
var str=obj;
if (str.length>0)
{
for (var i = str.length-1; i >= 0; i--)
{
var unicode=str.charCodeAt(i);
if (unicode>65280 && unicode<65375)
{
alert("请勿用全角输入!");
return false;
}
}
return true;
}
};
//全角转换为半角
for (var i = 0; i < len; i++){
if (str.charCodeAt(i)==12288){
result+= String.fromCharCode(str.charCodeAt(i)-12256);
continue;
}
if (str.charCodeAt(i)>65280 && str.charCodeAt(i)<65375) result+= String.fromCharCode(str.charCodeAt(i)-65248);
else result+= String.fromCharCode(str.charCodeAt(i));
}
str=result;
//去掉全角下的所有空格
str = str.replace(/ /g,"");
str = str.replace(/\s/g,"");
str = str.replace(" ","");
//汉字为两个字符
str = str.replace(/[^\x00-\xff]/g,'**');
//ie下去掉两边空格
replace(/^(\s|\u00A0)+/,'').replace(/(\s|\u00A0)+$/,'');
//去掉所有空格,非全角输入下
replace(/\s+/g,"");
//java 去掉全角下的所有空格
replaceAll("[ *| *| *|//s*]*", "");