1.var code = KaTeX parse error: Expected 'EOF', got '#' at position 3: ("#̲code_io").val()…("#code_io"):$()选择器,选择表单中id=code_io的 文本域,val() 是jQuery中特有的获取方法!
2.如何通过window.location.href传值?
?一个值&&第二个值
window.location.href = “servlet/LoginServlet?id=”+id+"&password="+password;
servlet中利用
String id = request.getParameter(“id”);
String password = request.getParameter(“password”);
获取通过window.location.href传来的值!
$("#lo").click(function() {
var code = $("#code_io").val();//获取手动输入的验证码
var id = $("#id").val(); //获取从键盘输入的账号
var password = $("#password").val();//获取从键盘输入的密码
if (code == "") {
alert("请输入验证码");
} else {
if (sms == code) {
window.location.href = "servlet/LoginServlet?id="+id+"&password="+password;
window.event.returnValue=false;
} else {
alert("失败后台验证码"+sms);
}
;
}
;
});