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;
   
posted @ 2010-12-09 18:15  刘竹青  阅读(586)  评论(0编辑  收藏  举报