var reversal = function(str){
var newStr = '';
if(Object.prototype.toString.call(str).slice(8,-1) !== 'String'){
alert("请填写字符串")
}else{
for(var i=0;i<str.length;i++){
newStr += ((str.charCodeAt(i)>96 && str.substr(i,1).toUpperCase()) || str.substr(i,1).toLowerCase());
}
}
return newStr;
}



