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

大家帮我看看我这个js表单验证怎么错了呢?点击没有反应,谢谢了
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
   
  <title>My JSP 'register.jsp' starting page</title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">  
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
  body {background-color:#333333}


  table.one
  {
  table-layout: fixed;
background-color:#0033FF;
border:none;
border-style:none;


 

 
  }


#yellow{
color:#FFFF00
}

#red{
color:#FF0000
}


#Layer1 {
position:relative;
width:700px;
height:800px;
z-index:1;
left: 337px;
top: 0px;
background-image:url(02.jpg);

}
  #Layer2 {
position:relative;
width:200px;
height:115px;
z-index:2;
left: 181px;
top: 66px;


}

  
  </style>
<script language="javascript">
function yanzheng()
{  
  if (CheckName()&&CheckPwd()&&onlyid())
  {  
  return true;
  }
  return false;
}





function CheckName()
{
  var name=document.form1.username;
  if (name.value.length==0)
  {
  window.alert("用户名不能为空!");
  name.focus();
  return false;
  }

  if(!/^\w{3,8}$/.test(name.value))
{
window. alert("用户名必须为3到8位(数字字母下划线)");
name.select();
return false;
}

  return true;
}
function CheckPwd()
{
  var pwd=document.form1.password; 
  if (pwd.value.length==0)
  {
  window.alert("密码不能为空!");
  pwd.focus();
  return false;
  }
  if (!/^\w{6,12}$/.test(pwd.value))
  {
  window.alert("密码长度在6到12位!");
  pwd.select();
  return false;
  }
  return true;
}

function onlyid()
{
var uid=document.form1.userid; 
 
 if (uid1.value.length==0)
  {
  window.alert("唯一标识不可为空!");
  uid1.focus();
  return false;
  }



return true;
}
</script>

  </head>
  
  
  <body>
  <div id="Layer1">
<div id="Layer2">
<form action="denglu.action" method="