解决JS中文乱码终极办法:
<tr>
<td width="117"><div align="right"><span style="color:#F00">*</span>必填 用户名:</div></td>
<td width="174"><input class="kuan"style="color:gray;font-style:italic;"
value="请输入用户名!" type="text" name="member.username" id="username" οnblur="checkName(vipRegister.username)"/></td>
<td colspan="2" id="usernameError"> <span id="toolTip"></span><br></td>
</tr>
解决办法:
JS函数中解决方式:
var namevalue=name.value;
var EncodeValue= encodeURI(encodeURI(namevalue));
//调用创建xmlhttp对象的函数,并传递参数
createXMLHttpRequest("MemberAction_checkUsername?username="+EncodeValue);
// oldpassword.focus();
进入到相应的Action中:
String Strname=null;
try {
Strname = URLDecoder.decode(username, "UTF-8");
check=memberService.checkUsername(Strname);
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}