js中解决乱码的问题
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="js/a.js" charset="utf-8"></script> <title>Insert title here</title> </head> <body bgcolor=cyan> <input name="UserPwd" type="password" onKeyPress="maskingKeyBoard()"> </body> </html>
添加 charset=“utf-8”
function maskingKeyBoard(){ if(event.keyCode==65){ event.KeyCode=0; event.returnValue=false; alert("当前的设置不允许使用键A"); } }