HTML用户登录页面里面login.js代码
function chkform(){
var oname =
document.getElementByIdx_x("txtusername");
if(oname.value != "admin"){
var oelement =
document.createElement_x("p");
var otextnode =
document.createtextnode("用户名错误!");
oelement.appendchild(otextnode);
document.getElementByIdx_x("frmlogin").appendchild(oelement);
oname.onfocus();
return false;
}
var opassword =
document.getElementByIdx_x("txtpassword");
if(opassword.value !=
“sa”){
var oelement
= document.createElement_x("p");
var otext =
document.createtextnode("密码错误!");
oelement.appendchild(otext);
document.getelmentbyid("frmlogin").appendchild(oelement);
opassword.onfocus();
return
false;
}
return
false;
}
document.getElementByIdx_x("btnok").onclick
= chkform;