// JavaScript Document
  //方法描述：把指定输入框中的全角字符转为半角字符，并在输入框失去焦点时自动改变输入框中的全角字符   
  //原理说明：   
  //      1、全角空格为12288，半角空格为32   
   //      2、其他字符半角(33-126)与全角(65281-65374)的对应关系是：均相差65248   
        function FullToDBC(obj){   
                var Str = obj.value;   
                var DBCStr = "";   
                for(var i = 0; i < Str.length; i++){   
                        var c = Str.charCodeAt(i);   
		//alert(c);
		// 显示正确&错误的代码
                        if(c == 12288){   
                                DBCStr += String.fromCharCode(32);   
                                continue;   
                        }   
                        if(c > 65280 && c < 65375){   
                                DBCStr += String.fromCharCode(c - 65248);   
                                continue;   
                        }   
						if(c == 12290){
                                DBCStr += String.fromCharCode(46);
                                continue;
                        }
                        DBCStr += String.fromCharCode(c);   
                }   
                obj.value = DBCStr;   
        }   
		
		//使用方法:在<input type="text" id="testStr" >   中插入onBlur="FullToDBC(this);"  