那位大大帮我看看这段代码,为什么有的IE提示有错误,有的就不提示。快疯了!
//记住用户名密码function saveInfo(){
var loginId=document.getElementById("loginId").value;
//loginId = cTrim(loginId,0);
var password=document.getElementById("password").value;
var date=new Date();
date.setTime(date.getTime()+365*24*3600*1000);
setCookie("loginId",loginId,date);
setCookie("password",password,date);
}
function setFocus(){
var userId = getCookieValue("loginId");
var ischeck = getCookieValue("che");
if(userId!=null){
document.getElementById("loginId").value=userId;
}
if(document.getElementById("loginId").value==""){
document.getElementById("loginId").focus();
}else{
document.getElementById("password").focus();
}
if(ischeck == "1"){
document.getElementById("che").checked=true;
}else{
document.getElementById("che").checked=false;
}
}
function reset()
{
document.getElementById("loginId").value='';
document.getElementById("password").value='';
document.getElementById("loginId").focus(true,true);
}
function login(){
//saveInfo();
var loginId=document.getElementById("loginId").value;
loginId = cTrim(loginId,0).toLowerCase();
var password=document.getElementById("password").value;
var ch=document.getElementsByName("che");
var l=ch.length;
var date=new Date();
for(var n=0;n<l;n++){
if(ch[n].checked){
date.setTime(date.getTime()+365*24*3600*1000);
setCookie("loginId",loginId,date);
setCookie("che","1",date);
}else{
date.setTime(date.getTime()+365*24*3600*1000);
clearCookie("loginId");
setCookie("che","2",date);
}
}
if(loginId==''||password==''){
Ext.Msg.alert('登录','请正确填写用户名或密码!');
if(loginId == ''){
document.getElementById("loginId").focus();
return;
}
if(password == ''){
document.getElementById("password").focus();
}
return ;
}
Ext.Ajax.request({
url:'<c:url value="/login/validate.do"/>',
params:{loginId:loginId,password:password},
method:'POST',
clientValidation:true ,
success:function(form,action){
var responseObject=form.responseText;
var items={};
try{
items=Ext.decode(responseObject);
}catch(e){
if(form.responseText.indexOf("failure :true")!=-1){
items.success=false;
items.info='连接数据库失败,请联系管理员!';
}
}
if(items.success){
<%String value = UtilResource.getPropertyInCache("config/organise",
"organise.loginSuccess");
pageContext.setAttribute("value", value);%>
window.location.href="<gtp:url/>/webbjkys/default.jsp";
}else{
Ext.Msg.alert('登录',items.info);
document.getElementById("password").focus();
}
},
failure:function(form,action){
Ext.Msg.alert('登录','连接数据库失败,请联系管理员!');
}
});
}