日期:2014-05-16  浏览次数:20356 次

编写了一个网页 为什么javascript就是不管用 求帮助 谢谢

<html>
<head>
  <meta http-equiv="Content-type" content="text/html; charset=GBK">
  <link type="text/css rel=stylesheet href=./css/mp/.css">
  <link type="text/css rel=stylesheet href=./css/examples.css">
   
 
 <script language=javascript>  
  //全局变量
 var flag = 0;
 function sub(){
  //登陆用户信息判断
  if (document.getElementById("username").value != " " 
  && document.getElementById("password").value != " " 
  && document.getElementById("passwordAgain").value != " "){
  if (flag >= 3){
  //验证成功,表单提交
  document.regist.onsubmit();
  }else{
  alert("请认真填写注册信息!");
  document.getElementById("username").value ="";
  document.getElementById("password").value ="";
  document.getElementById("passwordAgain").value ="";  
  document.getElementById("usName").innerHTML ="";
  document.getElementById("ps1").innerHTML ="";
  document.getElementById("ps2").innerHTML ="";
  }
  }
  }
  
  
 function res() {
  document.getElementById("username").value =""; 
  document.getElementById("password").value ="";  
  document.getElementById("passwordAgain").value ="";
  }
   
  function chang1(obj){
  var obValue = obj.value;
  if (obValue.length > 8 || obValue.length < 3){
  document.getElementById("usName").innerHTML ="<font name=usName 
  style='font-size:12px;color=red'>长度要求3~8位!</font>";
  flag = 0;
  }else{
  document.getElementById("usName").innerHTML ="<font name=usName style='font-size:12px;color=green'>可以使用</font>";
  flag++
  }
  }
   
  function chang2(obj){
  var obValue = obj.value;
  if (obValue.length > 8 || obValue.length < 6 {
  document.getElementById("ps1").innerHTML = "<font style ='font-size:12px,color=red’>长度要求6~8位!</font>";
  flag = 0;
  }else{
  document.getElementById("ps1").innerHTML = "</font style='font-size:12px;color=green'>可以使用</font>";
  flag++;
  }
  }
   
  function chang3(obj){
  var obValue = obj.value;
  var prrValue = document.getElementById("password").value;
  if(prrValue != obValue){
  document.getElementById("ps2").innerHTML ="<font
  style='font-size:12px;color=red'>请在此确认</font>";
  flag = 0;
  }else{
  document.getElementById("ps2").innerHTML = "<font
  style='font-size:12px;color=green'&g